#include<bits/stdc++.h>
#define Tp template<typename Ty>
#define Ts template<typename Ty,typename... Ar>
#define Rg register
#define RI Rg int
#define Cn const
#define CI Cn int&
#define I inline
#define W while
#define N 1000000
#define M 640000
#define LN 21
#define X 998244353
#define I2 499122177
#define add(x,y,z) (e[++ee].nxt=lnk[x],e[lnk[x]=ee].to=y,e[ee].v=z)
#define nadd(x,y,z) (ne[++nee].nxt=nlnk[x],ne[nlnk[x]=nee].to=y,ne[nee].v=z)
using namespace std;
namespace FastIO
{
	#define FS 100000
	#define tc() (FA==FB&&(FB=(FA=FI)+fread(FI,1,FS,stdin),FA==FB)?EOF:*FA++)
	#define pc(c) (FC==FE&&(clear(),0),*FC++=c)
	int OT;char oc,FI[FS],FO[FS],OS[30],*FA=FI,*FB=FI,*FC=FO,*FE=FO+FS;
	I void clear() {fwrite(FO,1,FC-FO,stdout),FC=FO;}
	Tp I void read(Ty& x) {x=0;W(!isdigit(oc=tc()));W(x=(x<<3)+(x<<1)+(oc&15),isdigit(oc=tc()));}
	Tp I void writeln(Ty x) {W(OS[++OT]=x%10+48,x/=10);W(OT) pc(OS[OT--]);pc('\n');}
}using namespace FastIO;
int n,m,pw[N+5],ee,lnk[N+5];struct edge {int to,nxt,v;}e[2*M+5];
int ct,nee,bl[N+5],nlnk[N+5];edge ne[2*N+5];
int V[N+5],C[N+5],vis[N+5];void GetV(CI b,CI x)
{
	vis[x]=1,nadd(b,x,0),nadd(x,b,0);
	for(RI i=lnk[x];i;i=e[i].nxt) !vis[e[i].to]&&bl[e[i].to]==b&&(V[b]=(V[b]+e[i].v)%X);
	for(RI i=lnk[x];i;i=e[i].nxt) if(!vis[e[i].to]&&bl[e[i].to]==b) return GetV(b,e[i].to);
}
int d,dfn[N+5],low[N+5],T,S[N+5];void Tarjan(CI x=1,CI lst=0)
{
	dfn[x]=low[x]=++d,S[++T]=x;for(RI i=lnk[x],y;i;i=e[i].nxt) if((y=e[i].to)^lst)
	{
		if(dfn[y]) {low[x]=min(low[x],dfn[y]);continue;}
		if(Tarjan(y,x),low[y]>dfn[x])
		{
			nadd(x,y,e[i].v),nadd(y,x,e[i].v);
			++ct;W(++C[bl[S[T]]=ct],S[T--]^y);
			if(C[ct]==1) C[ct--]=0,bl[y]=-1;else GetV(ct,y),V[ct]=1LL*V[ct]*I2%X;
		}
		else low[x]=min(low[x],low[y]);
	}
	if(!lst)
	{
		++ct;W(++C[bl[S[T]]=ct],S[T--]^x);
		if(C[ct]==1) --ct;else GetV(ct,x),V[ct]=1LL*V[ct]*I2%X;
	}
}
int f[N+5][LN+1],D[N+5],SV[N+5],SC[N+5];void dfs(CI x)
{
	RI i,y;for(i=1;f[x][i]=f[f[x][i-1]][i-1];++i);
	for(i=nlnk[x];i;i=ne[i].nxt) (y=ne[i].to)^f[x][0]&&(D[y]=D[f[y][0]=x]+1,SV[y]=(0LL+SV[x]+ne[i].v+V[y])%X,SC[y]=SC[x]+(y>n),dfs(y),0);
}
I void Init()
{
	RI i,x,y;for(i=1;i<=ee;i+=2) bl[x=e[i].to]^bl[y=e[i+1].to]&&(nadd(x,y,e[i].v),nadd(y,x,e[i].v));dfs(1);
}
I int LCA(RI x,RI y)
{
	RI i;for(D[x]<D[y]&&(swap(x,y),0),i=0;D[x]^D[y];++i) (D[x]^D[y])>>i&1&&(x=f[x][i]);if(x==y) return x;
	for(i=0;f[x][i]^f[y][i];++i);for(--i;~i;--i) f[x][i]^f[y][i]&&(x=f[x][i],y=f[y][i]);return f[x][0];
}
I int Q(CI x,CI y)
{
	RI z=LCA(x,y);
	return (SV[x]+SV[y]-2LL*SV[z]%X+V[z]+X)*pw[SC[x]+SC[y]-2*SC[z]+(z>n)]%X;
}
int main()
{
	freopen("simple.in","r",stdin),freopen("simple.out","w",stdout);
	RI Qt,i,x,y,z;for(read(n),read(m),read(Qt),i=1;i<=m;++i) read(x),read(y),read(z),add(x,y,z),add(y,x,z);
	for(pw[0]=i=1;i<=n;++i) pw[i]=(pw[i-1]<<1)%X;ct=n,Tarjan(),Init();
	for(i=1;i<=Qt;++i) read(x),read(y),writeln(Q(x,y));return clear(),0;
}