#include<bits/stdc++.h>
#define For(i,a,b) for(int i=(a);i<=(b);++i)
#define Rep(i,a,b) for(int i=(a);i>=(b);--i)
using namespace std;
inline int read()
{
	char c=getchar();int x=0,f=0;
	for(;!isdigit(c);c=getchar())if(c=='-')f=1;
	for(;isdigit(c);c=getchar())x=(x<<1)+(x<<3)+(c^48);
	if(f)x=-x;return x;
}

#define mod 998244353
struct modint{
	int x;
	modint(int o=0){x=o;}
	modint&operator =(int o){return x=o,*this;}
	modint&operator +=(modint o){return x=x+o.x>=mod?x+o.x-mod:x+o.x,*this;}
	modint&operator -=(modint o){return x=x-o.x<0?x-o.x+mod:x-o.x,*this;}
	modint&operator *=(modint o){return x=1ll*x*o.x%mod,*this;}
	modint&operator ^=(int b){
		modint c=1,a=*this;
		for(;b;b>>=1,a*=a)if(b&1)c*=a;
		return x=c.x,*this;
	}
	modint&operator /=(modint o){return (*this)*=(o^=(mod-2));}
	friend modint operator +(modint a,modint b){return a+=b;}
	friend modint operator -(modint a,modint b){return a-=b;}
	friend modint operator *(modint a,modint b){return a*=b;}
	friend modint operator /(modint a,modint b){return a/=b;}
	modint operator -(){return x?mod-x:0;}
};

#define fi first
#define se second
#define pb push_back
#define mkp make_pair
typedef pair<int,int>pii;
typedef vector<int>vi;

#define maxn 500005
#define inf 0x3f3f3f3f

int n,m,Q;
vector<pii>e[maxn];

modint pw2[maxn];

int dep[maxn],fa[maxn],sz[maxn];
int top[maxn],son[maxn],cnt[maxn],size[maxn];
modint dis[maxn],wei[maxn];

void dfs1(int u,int pa){
	dep[u]=dep[pa]+1,fa[u]=pa;
	sz[u]=1;
	for(auto it:e[u]){
		int v=it.fi,w=it.se;
		if(v==pa)continue;
		dis[v]=dis[u]+w;
		cnt[v]=cnt[u]+(size[v]>1);
		wei[v]+=wei[u];
		dfs1(v,u),sz[u]+=sz[v];
		if(sz[v]>sz[son[u]])son[u]=v;
	}
}
void dfs2(int u,int tp){
	top[u]=tp;
	if(son[u]) dfs2(son[u],tp);
	for(auto it:e[u]){
		int v=it.fi,w=it.se;
		if(v==fa[u]||v==son[u])continue;
		dfs2(v,v);
	}
}
int lca(int u,int v){
	while(top[u]!=top[v]){
		if(dep[top[u]]<dep[top[v]])swap(u,v);
		u=fa[top[u]];
	}
	return dep[u]<dep[v]?u:v;
}

void tree()
{
	For(i,1,m){
		int u=read(),v=read(),w=read();
		e[u].pb(mkp(v,w)),e[v].pb(mkp(u,w));
	}
	dfs1(1,0),dfs2(1,1);
	For(i,1,Q){
		int u=read(),v=read(),t=lca(u,v);
		modint res=dis[u]+dis[v]-2*dis[t];
		printf("%d\n",res.x);
	}
}


vector<pii>G[maxn];

int uu[maxn],vv[maxn],ww[maxn];
int dfn[maxn],low[maxn],idx,stk[maxn],tp,scc,bel[maxn];
bool ins[maxn];
void tarjan(int u,int pa){
	dfn[u]=low[u]=++idx;
	stk[++tp]=u,ins[u]=1;
	for(auto it:G[u]){
		int v=it.fi;
		if(v==pa)continue;
		if(!dfn[v]){
			tarjan(v,u);
			low[u]=min(low[u],low[v]);
		}
		else if(ins[v]) low[u]=min(low[u],dfn[v]);
	}
	if(low[u]==dfn[u]){
		++scc; int v;
		do{
			v=stk[tp--];
			ins[v]=0;
			bel[v]=scc;
			++size[scc];
		}while(u!=v);
	}
}

void huan()
{
	For(i,1,m){
		int u=read(),v=read(),w=read();
		G[u].pb(mkp(v,w));
		G[v].pb(mkp(u,w));
		uu[i]=u,vv[i]=v,ww[i]=w;
	}
	For(i,1,n)
		if(!dfn[i])tarjan(i,0);
//	For(i,1,n)cout<<bel[i]<<' ';puts("");
	For(i,1,m){
		int u=uu[i],v=vv[i],w=ww[i];
		u=bel[u],v=bel[v];
		if(u==v) wei[u]+=w;
		else e[u].pb(mkp(v,w)),e[v].pb(mkp(u,w));
	}
	cnt[1]=(size[1]>1);
	dfs1(1,0);
	dfs2(1,1);
//	For(i,1,scc)cout<<cnt[i]<<' ';puts("");
	For(i,1,Q){
		int u=read(),v=read();
		if(u==v){
			puts("0");
			continue;
		}
		u=bel[u],v=bel[v];
		int t=lca(u,v);
		modint res=dis[u]+dis[v]-2*dis[t];
		int allc=cnt[u]+cnt[v]-cnt[t]-cnt[fa[t]];
		modint allw=wei[u]+wei[v]-wei[t]-wei[fa[t]];
	//	cout<<"c,w "<<allc<<' '<<allw.x<<endl;
		res*=pw2[allc];
		if(allc) res+=allw*pw2[allc-1];
		printf("%d\n",res.x);
	}
}

signed main()
{
	freopen("simple.in","r",stdin);
	freopen("simple.out","w",stdout);
	n=read(),m=read(),Q=read();
	pw2[0]=1;
	For(i,1,n)pw2[i]=pw2[i-1]*2;
	if(m==n-1)tree(),exit(0);
	huan();
	return 0;
}

/*
5 5 6
1 2 10
2 3 2
2 4 5
2 5 4
4 5 3
1 5
2 5
3 5
3 4
4 5
4 4
*/
