#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
const int N=1.3e6,md=998244353;
int n,m,q,head[N],cnt;
struct edge{
	int to,nxt,w;
}e[N*2];
namespace tre{
	int dep[N],sz[N],son[N],fa[N],top[N],dis[N];
	void dfs(int u){
		sz[u]=1;
		for(int i=head[u];i;i=e[i].nxt)if(!dep[e[i].to]){
			dep[e[i].to]=dep[u]+1;
			fa[e[i].to]=u;
			dis[e[i].to]=(dis[u]+e[i].w)%md;
			dfs(e[i].to);
			sz[u]+=sz[e[i].to];
			if(!son[u]||sz[son[u]]<sz[e[i].to])son[u]=e[i].to;
		}
	}
	void dfs2(int u){
		if(son[u])top[son[u]]=top[u],dfs2(son[u]);
		for(int i=head[u];i;i=e[i].nxt)
			if(dep[e[i].to]>dep[u]&&e[i].to!=son[u])
				dfs2(top[e[i].to]=e[i].to);
	}
	inline int LCA(int u,int v){
		while(top[u]!=top[v])
			if(dep[top[u]]>dep[top[v]])u=fa[top[u]];
			else v=fa[top[v]];
		return dep[u]<dep[v]?u:v;
	}
	void work(){
		for(int i=1;i<=m;++i){
			int u,v,w;
			cin>>u>>v>>w;
			e[++cnt]=(edge){v,head[u],w},head[u]=cnt;
			e[++cnt]=(edge){u,head[v],w},head[v]=cnt;
		}
		dfs(dep[1]=1),dfs2(top[1]=1);
		while(q--){
			int u,v;
			cin>>u>>v;
			int t=LCA(u,v);
			int ans=(LL)(dis[u]+dis[v]+md-dis[t]+md-dis[t])%md;
			cout<<ans<<'\n';
		}
	}
}
namespace gra{
	int SCC,dfn[N],sta[N],top,low[N],idx,bel[N],val[N];
	bool vis[N];
	vector<pair<int,int> >G[N];
	void tarjan(int u,int p){
		sta[++top]=u;
		vis[u]=1;
		low[u]=dfn[u]=++idx;
		for(int i=head[u];i;i=e[i].nxt)if(!dfn[e[i].to]&&e[i].to!=p){
			tarjan(e[i].to,u);
			low[u]=min(low[u],low[e[i].to]);
		}else if(vis[e[i].to]&&e[i].to!=p)
			low[u]=min(low[u],dfn[e[i].to]);
		if(low[u]==dfn[u]){
			++SCC;
			int v;
			do{
				v=sta[top--];
				vis[v]=0;
				bel[v]=SCC;
			}while(v!=u);
		}
	}
	int sz[N],Top[N],fa[N],dep[N],son[N],pw[N],ipw[N];
	int ctb[N],sum[N],sum2[N];
	bool big[N];
	void dfs(int u){
		sz[u]=1;
		ctb[u]=ctb[fa[u]]+big[u];
		for(auto it:G[u]){
			int v=it.first;
			if(dep[v])continue;
			sum[v]=(sum[u]+it.second)%md;
			sum2[v]=(sum2[u]+val[v])%md;
			dep[v]=dep[u]+1;
			fa[v]=u;
			dfs(v);
			sz[u]+=sz[v];
			if(!son[u]||sz[son[u]]<sz[v])son[u]=v;
		}
	}
	void dfs2(int u){
		if(son[u])Top[son[u]]=Top[u],dfs2(son[u]);
		for(auto it:G[u]){
			int v=it.first;
			if(v==son[u]||dep[v]<dep[u])continue;
			dfs2(Top[v]=v);
		}
	}
	inline int LCA(int u,int v){
		while(Top[u]!=Top[v])
			if(dep[Top[u]]>dep[Top[v]])u=fa[Top[u]];
			else v=fa[Top[v]];
		return dep[u]<dep[v]?u:v;
	}
	inline int calc(int u,int v){
		int res=(sum[u]+md-sum[v])%md;
		res=(LL)res*ipw[ctb[v]]%md;
		return res;
	}
	void work(){
		for(int i=1;i<=m;++i){
			int u,v,w;
			cin>>u>>v>>w;
			e[++cnt]=(edge){v,head[u],w},head[u]=cnt;
			e[++cnt]=(edge){u,head[v],w},head[v]=cnt;
		}
		SCC=n;
		tarjan(1,0);
		for(int u=1;u<=n;++u)
			for(int i=head[u];i;i=e[i].nxt){
				if(e[i].to<u)continue;
				if(bel[u]==bel[e[i].to]){
					int x=bel[u];
					val[x]=(val[x]+e[i].w)%md;
					big[x]=1;
				}else{
					int x=u,y=e[i].to,g=e[i].w;
					G[x].emplace_back(y,g);
					G[y].emplace_back(x,g);
				}
			}
		for(int u=1;u<=n;++u)if(big[bel[u]]){
			int v=bel[u];
			G[u].emplace_back(v,0);
			G[v].emplace_back(u,0);
		}
/*		for(int u=1;u<=SCC;++u)
			for(auto it:G[u])if(it.first>u){
				cerr<<u<<' '<<it.first<<' '<<it.second<<endl;
			}
*/		for(int i=*pw=1;i<=n;++i)pw[i]=pw[i-1]*2%md;
		for(int i=*ipw=1;i<=n;++i){
			ipw[i]=ipw[i-1]*(LL)(md+1)/2%md;
		}
		dfs(dep[1]=1),dfs2(Top[1]=1);
		while(q--){
			int u,v;
			cin>>u>>v;
			int t=LCA(u,v);
			int ct=ctb[u]+ctb[v]-ctb[t]*2;
			int x=((LL)sum[u]+sum[v]-2LL*sum[t]%md+md)%md;
			int y=((LL)sum2[u]+sum2[v]-2LL*sum2[t]%md+md)%md;
//			cerr<<x<<' '<<y<<' '<<t<<endl;
			x=(LL)x*pw[ct]%md;
			if(ct)y=(LL)y*pw[ct-1]%md;else y=0;
			int s=(x+y)%md;
			if(big[t])s=(s*2+val[t]*pw[ct])%md;
			cout<<s<<'\n';
		}
	}
}
int main(){
	freopen("simple.in","r",stdin);
	freopen("simple.out","w",stdout);
	ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);
	cin>>n>>m>>q;
	if(m==n-1)tre::work();
	else gra::work();
}
