#include <bits/stdc++.h>
using namespace std;
using namespace std;
const int N = 8005, mod = 998244353;
int k, ans, tmp[85], C[85][85], Ans[85];
struct wt {
  int n, nxt[N], head[N], vet[N], edgenum, f[N][85], g[85];
  void Add(int u, int v) {
    vet[++edgenum] = v;
    nxt[edgenum] = head[u];
    head[u] = edgenum;
  }
  void dfs(int x, int fa) {
    for (int e = head[x]; e; e = nxt[e]) {
      int v = vet[e];
      if (v == fa) continue;
      dfs(v, x);
    }
    f[x][0] = 1;
    for (int e = head[x]; e; e = nxt[e]) {
      int v = vet[e];
      if (v == fa) continue;
      for (int i = 2; i <= k; i += 2) tmp[i] = (tmp[i] + f[v][i - 2]) % mod;
    }
    for (int i = 2; i <= k; i += 2) {
      Ans[i] = 1ll * i * tmp[i] % mod;
      for (int j = 2; j <= i; j += 2) {
        f[x][i] = (1ll * f[x][i - j] * tmp[j] + f[x][i]) % mod;
        Ans[i] = (1ll * Ans[i - j] * tmp[j] + Ans[i]) % mod;
      }
    }
    for (int i = 2; i <= k; i += 2)
      g[i] = (g[i] + Ans[i]) % mod, tmp[i] = Ans[i] = 0;
  }
  void init() {
    g[0] = n;
    for (int i = 1; i < n; i++) {
      int u, v;
      scanf("%d%d", &u, &v);
      Add(u, v), Add(v, u);
    }
    dfs(1, 0);
  }
} T1, T2;
int main() {
  scanf("%d%d%d", &T1.n, &T2.n, &k);
  T1.init(), T2.init();
  for (int i = 0; i <= k; i++) {
    C[i][0] = 1;
    for (int j = 1; j <= i; j++)
      C[i][j] = (C[i - 1][j] + C[i - 1][j - 1]) % mod;
  }
  for (int i = 0; i <= k; i += 2)
    ans = (ans + 1ll * T1.g[i] * T2.g[k - i] % mod * C[k][i] % mod) % mod;
  printf("%d\n", ans);
  return 0;
}
