#include <bits/stdc++.h>

using namespace std;
#define P 998244353
#define N 500001

vector<pair<int, int>> e[N], e1[N];
int n, m, q, u, v, w, rt, cur_sp, vis[N], bel[N], d[N], f[N][20];
int sumw, decw, len_edge[N], dis_edge[N], ind, id_edge[N], i2, od_edge[N];
long long g[N][20], h[N][20];
bool has, sp[N];

template<typename t1, typename t2>
void inc(t1& x, t2 y) { x = (x + y) % P; }

long long inv(long long x, int y = P - 2) {
	long long ret = 1;
	while (y) {
		if (y & 1) ret = ret * x % P;
		x = x * x % P;
		y /= 2;
	}
	return ret;
}

void dfs1(int cur, int father, int st) {
	for (auto [u, v] : e[cur])
		if (u != father)
			if (!sp[u]) dfs1(u, cur, st); else
			if (u == st) sp[cur] = 1;
}

void dfs2(int cur, int father, int st) {
	for (auto [u, w] : e[cur])
		if (u != father) {
			inc(sumw, w);
			if (sp[u]) {
				if (u > st) {
					if (!vis[u]) e1[st].push_back(make_pair(u, 0));
					++vis[u];
					inc(h[cur_sp = u][0], sumw);
					++g[u][0];
					++ind;
				} else cur_sp = sumw = decw = 0;
			} else dfs2(u, cur, st);
			if (cur_sp)
				if (cur == st) sumw = decw = 0; else {
					inc(decw, w);
					bel[cur] = cur_sp;
					len_edge[cur] = sumw;
					dis_edge[cur] = decw;
					id_edge[cur] = ind;
					od_edge[cur] = ++i2;
				}
		}
}

void dfs3(int cur, int fa, int de) {
	d[cur] = de;
	f[cur][0] = fa;
	for (int i = 1; i < 20; ++i) {
		f[cur][i] = f[f[cur][i - 1]][i - 1];
		g[cur][i] = g[cur][i - 1] * g[f[cur][i - 1]][i - 1] % P;
		h[cur][i] = (h[cur][i - 1] * g[f[cur][i - 1]][i - 1] +
				h[f[cur][i - 1]][i - 1] * g[cur][i - 1]) % P;
	}
	for (auto [u, c] : e1[cur]) dfs3(u, cur, de + 1);
}

int lca(int u, int v) {
	if (d[u] < d[v]) swap(u, v);
	for (int i = 19; i >= 0; --i)
		if (d[f[u][i]] >= d[v])
			u = f[u][i];
	if (u == v) return u;
	for (int i = 19; i >= 0; --i)
		if (f[u][i] != f[v][i]) {
			u = f[u][i];
			v = f[v][i];
		}
	return f[u][0];
}

int main() {
	freopen("simple.in", "r", stdin);
	freopen("simple.out", "w", stdout);
	scanf("%d%d%d", &n, &m, &q);
	while (m--) {
		scanf("%d%d%d", &u, &v, &w);
		e[u].push_back(make_pair(v, w));
		e[v].push_back(make_pair(u, w)); 
	}
	
	for (int i = 1; i <= n; ++i)
		if (sp[i] = e[i].size() != 2)
			has = 1;
	if (!has) sp[1] = 1;
	for (int i = 1; i <= n; ++i)
		if (sp[i])
			dfs1(i, 0, i);
	for (int i = 1; i <= n; ++i)
		if (sp[i]) {
			dfs2(i, 0, i);
			if (!rt) rt = i;
			for (auto& [u, c] : e1[i]) {
				c = vis[u];
				vis[u] = 0;
			}
		}
	dfs3(rt, 0, 1);
	
	while (q--) {
		scanf("%d%d", &u, &v);
		if (!sp[u] && !sp[v] && bel[u] == bel[v]) {
			if (u == v) puts("0"); else
			if (id_edge[u] == id_edge[v]) {
				if (od_edge[u] > od_edge[v]) swap(u, v);
				printf("%lld\n", (((len_edge[u] - dis_edge[v] + dis_edge[u]) *
						(g[bel[u]][0] - 2) + h[bel[u]][0]) % P + P) % P);
			} else
				printf("%lld\n", (((len_edge[u] + len_edge[v]) * (g[bel[u]][0] - 1)
						+ (h[bel[u]][0] - len_edge[u] - len_edge[v]) * 2) % P + P) % P);
			continue;
		}
		if (sp[u] < sp[v]) swap(u, v);
		long long pre_tot = 1, pre_sum = 0;
		if (!sp[v])
			if (sp[u]) {
				pre_tot = g[bel[v]][0];
				if (lca(bel[v], u) == bel[v]) {
					pre_sum = (h[bel[v]][0] +
							(len_edge[v] - dis_edge[v]) * (g[bel[v]][0] - 2)) % P;
					v = bel[v];
				} else {
					pre_sum = (h[bel[v]][0] + dis_edge[v] * (g[bel[v]][0] - 2)) % P;
					v = f[bel[v]][0];
				}
			} else {
				if (d[bel[u]] < d[bel[v]]) swap(u, v);
				if (lca(bel[u], bel[v]) == bel[v]) {
					pre_tot = g[bel[v]][0];
					pre_sum = (h[bel[v]][0] +
							(len_edge[v] - dis_edge[v]) * (g[bel[v]][0] - 2)) % P;
					
					pre_sum = (pre_sum * g[bel[u]][0] + (h[bel[u]][0] +
							dis_edge[u] * (g[bel[u]][0] - 2)) % P * pre_tot) % P;
					pre_tot = pre_tot * g[bel[u]][0] % P;
					v = bel[v];
				} else {
					pre_tot = g[bel[v]][0];
					pre_sum = (h[bel[v]][0] + dis_edge[v] * (g[bel[v]][0] - 2)) % P;
					
					pre_sum = (pre_sum * g[bel[u]][0] + (h[bel[u]][0] +
							dis_edge[u] * (g[bel[u]][0] - 2)) % P * pre_tot) % P;
					pre_tot = pre_tot * g[bel[u]][0] % P;
					v = f[bel[v]][0];
				}
				u = f[bel[u]][0];
			}
		
		int l = lca(u, v), ans = 0;
		long long tot = pre_tot;
		for (int i = 19, t = u; i >= 0; --i)
			if (d[f[t][i]] >= d[l]) {
				tot = tot * g[t][i] % P;
				t = f[t][i];
			}
		for (int i = 19, t = v; i >= 0; --i)
			if (d[f[t][i]] >= d[l]) {
				tot = tot * g[t][i] % P;
				t = f[t][i];
			}
		ans = pre_sum * tot % P * inv(pre_tot) % P;
		for (int i = 19, t = u; i >= 0; --i)
			if (d[f[t][i]] >= d[l]) {
				inc(ans, h[t][i] * tot % P * inv(g[t][i]));
				t = f[t][i];
			}
		for (int i = 19, t = v; i >= 0; --i)
			if (d[f[t][i]] >= d[l]) {
				inc(ans, h[t][i] * tot % P * inv(g[t][i]));
				t = f[t][i];
			}
		printf("%lld\n", ans);
	}
	fclose(stdin);
	fclose(stdout);
	return 0;
}
