#include<bits/stdc++.h>
#define int long long
#define pb push_back
#define mp make_pair
#define x first
#define y second
using namespace std;

inline int read()
{
	int num=0,f=1;char ch=getchar();
	while(!((ch<='9'&&ch>='0')||ch=='-'))ch=getchar();
	if (ch=='-')f=-1,ch=getchar();
	while(ch<='9'&&ch>='0')num=num*10+ch-'0',ch=getchar();
	return num*f;
}

void ckmax(int &a,int b){a=(a>b?a:b);}

const int Mod=998244353;
const int M=5e5+10;
int n,dis[M],fa[25][M],dep[M],m,q;
vector<pair<int,int> >e[M];

void dfs(int u,int ff)
{
	fa[0][u]=ff,dep[u]=dep[ff]+1;
	for (auto v:e[u])
	{
		if (v.x==ff)continue;
		dis[v.x]=dis[u]+v.y,dfs(v.x,u);
	}
}

void init()
{
	for (int i=1;i<=20;i++)
		for (int j=1;j<=n;j++)
			fa[i][j]=fa[i-1][fa[i-1][j]];
}

int LCA(int u,int v)
{
	if (dep[u]<dep[v])swap(u,v);
	for (int i=20;i>=0;i--)
		if (dep[fa[i][u]]>=dep[v])u=fa[i][u];
	if (u==v)return u;
	for (int i=20;i>=0;i--)
		if (fa[i][u]!=fa[i][v])u=fa[i][u],v=fa[i][v];
	return fa[0][u];
}

signed main()
{
	freopen("simple.in","r",stdin);
	freopen("simple.out","w",stdout);
	n=read(),m=read(),q=read();
	for (int i=1;i<=m;i++)
	{
		int u=read(),v=read(),w=read();
		e[u].pb(mp(v,w)),e[v].pb(mp(u,w));
	}
	dfs(1,0);init();
	while(q--)
	{
		int s=read(),t=read(),lca=LCA(s,t);
		int ans=dis[s]+dis[t]-dis[lca]*2;
		cout<<ans%Mod<<'\n';
	}
	return 0;
}
