#include <bits/stdc++.h>
using namespace std;
#define R(i, a, b) for (int i = (a); i < (b); ++i)
#define L(i, a, b) for (int i = (b) - 1; i >= (a); --i)
using i64 = long long;
constexpr int M = 998244353;
struct mint {
  int x;
  const int operator()() {
    return x;
  }
  mint(int _x = 0) : x(_x) {}
};
mint operator+(const mint &a, const mint &b) {
  const int x = a.x + b.x;
  return x < M ? x : x - M;
}
mint operator-(const mint &a, const mint &b) {
  const int x = a.x - b.x;
  return x < 0 ? x + M : x;
}
mint operator*(const mint &a, const mint &b) {
  return i64(a.x) * b.x % M;
}
mint &operator+=(mint &a, const mint &b) {
  a = a + b; return a;
}
mint &operator*=(mint &a, const mint &b) {
  a = a * b; return a;
}
mint pw(mint a, int x = M - 2) {
  mint res = 1;
  for (; x; x >>= 1, a *= a) if (x & 1) res *= a;
  return res;
}
constexpr int xn = 500007, xm = 640007, xk = 20;
int n, m, nT, c[xn];
int fe[xn], fk[xk][xn], *fa = fk[0], D[xn], tp[xn], cnt[xn];
mint sum[xn], sd[xn];
struct edge { int u, v, w; } E[xm];
vector<int> G[xn];
int get(int u, int i) {
  return E[i].u ^ E[i].v ^ u;
}
void dfs0(int u) {
  for (int k = 0; ~fk[k][u]; ++k) fk[k + 1][u] = fk[k][fk[k][u]];
  for (const int &i : G[u]) {
    int v = get(u, i); if (v == fa[u]) continue;
    if (!~D[v]) {
      fe[v] = i; fa[v] = u; D[v] = D[u] + 1; dfs0(v);
      continue;
    }
    if (D[v] > D[u]) continue;
    for (int w = u; w != v; w = fa[w]) {
      tp[w] = v; sum[v] += E[fe[w]].w;
    }
    sum[v] += E[i].w;
  }
}
int leap(int u, int d) {
  L(k, 0, xk) if (d >> k & 1) u = fk[k][u]; return u;
}
int lca(int u, int v) {
  if (D[u] < D[v]) swap(u, v);
  if ((u = leap(u, D[u] - D[v])) == v) return u;
  L(k, 0, xk) if (fk[k][u] != fk[k][v]) {
    u = fk[k][u]; v = fk[k][v];
  }
  return fa[u];
}
int main() {
  freopen("simple.in", "r", stdin); freopen("simple.out", "w", stdout);
  ios::sync_with_stdio(false); cin.tie(0);
  cin >> n >> m >> nT;
  R(i, 0, m) {
    int u, v, w; cin >> u >> v >> w; --u; --v;
    E[i] = {u, v, w};
    G[u].push_back(i); G[v].push_back(i);
  }
  fill(D, D + n, -1); iota(tp, tp + n, 0);
  memset(fk, -1, sizeof fk);
  fe[0] = -1; fa[0] = -1; D[0] = 0; dfs0(0);
  R(u, 0, n) c[D[u]] += 1; R(i, 1, n) c[i] += c[i - 1];
  vector<int> o(n);
  R(u, 0, n) o[--c[D[u]]] = u;
  for (const int &u : o) if (u) {
    int v = fa[u];
    cnt[u] = cnt[v]; sd[u] = sd[v];
    if (tp[u] == v) {
      cnt[u] += 1; sd[u] += sum[v];
    }
    else if (tp[u] != tp[v]) sd[u] += 2 * E[fe[u]].w;
  }
  R(T, 0, nT) {
    int u, v; cin >> u >> v; --u; --v;
    int w = lca(u, v), c = cnt[u] + cnt[v] - 2 * cnt[w];
    mint s = sd[u] + sd[v] - 2 * sd[w];
    if (tp[w] != w and ((w != u and tp[leap(u, D[u] - D[w] - 1)] == tp[w]) or (w != v and tp[leap(v, D[v] - D[w] - 1)] == tp[w]))) {
      c += 1; s += sum[tp[w]];
    }
    cout << (pw(2, M - 1 + c - 1) * s)() << '\n';
  }
  return 0;
}