#include <bits/stdc++.h>

#define see(x) std::cout << #x << " = " << x << std::endl

int init_io = []{
#ifndef CM_DEBUG
	freopen("simple.in", "r", stdin);
	freopen("simple.out", "w", stdout);
#endif
	return 0;
}();

template <class T, typename = typename T::iterator>
std::ostream &operator<< (std::ostream &out, const T &v)
{
	out << "{";
	for (const auto &x : v) out << x << ", ";
	out << "}";
	return out;
}

const int MOD = 998244353;
const int N = 500005;
std::vector<std::pair<int, int>> e[N];
int n, m, q;

int p2[N];

std::vector<int> et[N];
bool in_cyc[N];
int wc[N], we[N], cc[N];

std::vector<int> st;
int dfn[N], low[N], dfn_cur, wu[N];
void dfs_build(int u, int f)
{
	st.push_back(u);
	low[u] = dfn[u] = dfn_cur++;
	for (const auto &[v, w] : e[u]) if (v != f)
	{
		if (dfn[v] == -1) 
		{
			wu[v] = w;
			dfs_build(v, u);
			low[u] = std::min(low[u], low[v]);

			if (low[v] >= dfn[u])
			{
				if (st.back() == v)
				{
					st.pop_back();
					et[u].push_back(v);
					we[v] = w;
					in_cyc[v] = false;
				}
				else
				{
					std::vector<int> ss;
					int cur_w = 0;

					for (const auto &[vv, ww] : e[st.back()])
						if (vv == u)
							cur_w = ww;

					while (st.back() != v)
					{
						cur_w = (cur_w + wu[st.back()]) % MOD;
						ss.push_back(st.back());
						st.pop_back();
					}
					cur_w = (cur_w + wu[v]) % MOD;
					ss.push_back(v);
					st.pop_back();

					for (int v : ss)
					{
						et[u].push_back(v);
						in_cyc[v] = true;
						wc[v] = cur_w;
						cc[v] = 1;
					}
				}
			}
		}
		else
		{
			low[u] = std::min(low[u], dfn[v]);
		}
	}
}

const int B = 20;
int fa[N][B], dep[N];
int wep[N], wcp[N], ccp[N];
void dfs_init(int u, int f)
{
	wep[u] = (we[u] + wep[f]) % MOD;
	wcp[u] = (wc[u] + wcp[f]) % MOD;
	ccp[u] = (cc[u] + ccp[f]) % MOD;
	dep[u] = dep[f] + 1;
	fa[u][0] = f;
	// printf("u = %d: wep = %d, wcp = %d, ccp = %d\n", u, wep[u], wcp[u], ccp[u]);
	for (int i = 0; i + 1 < B; i++)
		fa[u][i + 1] = fa[fa[u][i]][i];
	for (int v : et[u]) dfs_init(v, u);
}

int up(int u, int d)
{
	for (int i = 0; i < B; i++)
		if (d & (1 << i))
			u = fa[u][i];
	return u;
}

int lca(int u, int v)
{
	if (dep[u] < dep[v]) std::swap(u, v);
	u = up(u, dep[u] - dep[v]);
	for (int i = B - 1; i >= 0; i--)
		if (fa[u][i] != fa[v][i])
			u = fa[u][i], v = fa[v][i];
	return u == v ? u : fa[u][0];
}

int main()
{
	p2[0] = 1;
	for (int i = 1; i < N; i++)
		p2[i] = p2[i - 1] * 2 % MOD;

	scanf("%d%d%d", &n, &m, &q);
	for (int i = 0; i < m; i++)
	{
		int u, v, w;
		scanf("%d%d%d", &u, &v, &w);
		e[u].emplace_back(v, w);
		e[v].emplace_back(u, w);
	}

	memset(dfn, -1, sizeof(dfn));
	dfs_build(1, 0);

	dfs_init(1, 0);
	for (int i = 0; i < q; i++)
	{
		int u, v;
		scanf("%d%d", &u, &v);
		if (dep[u] > dep[v]) std::swap(u, v);
		int l = lca(u, v);
		// printf("u, v, l = %d %d %d\n", u, v, l);

		int cur_cc = ccp[u] + ccp[v] - ccp[l] * 2;
		int cur_wc = (0ll + wcp[u] + wcp[v] + MOD * 2 - wcp[l] * 2) % MOD;
		int cur_we = (0ll + wep[u] + wep[v] + MOD * 2 - wep[l] * 2) % MOD;
		
		if (u != l && v != l)
		{
			int lu = up(u, dep[u] - dep[l] - 1);
			int lv = up(v, dep[v] - dep[l] - 1);
			if (in_cyc[lu] && in_cyc[lv])
			{
				cur_cc -= 1;
				cur_wc = (cur_wc + MOD - wc[lu]) % MOD;
			}
		}

		// printf("cc, wc, we = %d %d %d\n", cur_cc, cur_wc, cur_we);

		int ans;
		if (cur_cc == 0)
		{
			ans = cur_we;
		}
		else
		{
			ans = ((int64_t)p2[cur_cc] * cur_we + (int64_t)p2[cur_cc - 1] * cur_wc) % MOD;
		}

		printf("%d\n", ans);
	}

	return 0;
}
