#include <bits/stdc++.h>
const int mod = 998244353;
const int lim = 4000;
int f[4005][80], f1[4005][80], A[4005][80], g[4005][80], g1[4005][80],
    B[4005][80], C[4005][4005], n, m, k, u, v;
std::vector<int> c1[4005], c2[4005];
void dfs1(int u, int fa) {
  f[u][0] = 1;
  for (int v : c1[u]) {
    if (v == fa) continue;
    dfs1(v, u);
  }
  for (int i = 2; i <= k; ++i) {
    for (int v : c1[u]) {
      if (v == fa) continue;
      for (int j = 0; j + 2 <= i; j += 2) {
        f[u][i] = (f[u][i] + (long long)f[v][j] * f[u][i - j - 2] % mod) % mod;
      }
    }
  }
}
void dfs2(int u, int fa) {
  A[u][0] = 1;
  int t[80] = {0};
  for (int v : c1[u]) {
    for (int j = 0; j <= k; ++j) {
      if (v == fa)
        t[j] = (t[j] + f1[u][j]) % mod;
      else
        t[j] = (t[j] + f[v][j]) % mod;
    }
  }
  for (int i = 2; i <= k; ++i)
    for (int j = 0; j + 2 <= i; j += 2)
      A[u][i] = (A[u][i] + (long long)A[u][i - j - 2] * t[j] % mod) % mod;
  for (int v : c1[u]) {
    if (v == fa) continue;
    f1[v][0] = 1;
    for (int i = 2; i <= k; ++i)
      for (int j = 0; j + 2 <= i; j += 2)
        f1[v][i] = (f1[v][i] + (long long)f1[v][i - j - 2] *
                                   (t[j] - f[v][j] + mod) % mod) %
                   mod;
    dfs2(v, u);
  }
}
void dfs3(int u, int fa) {
  g[u][0] = 1;
  for (int v : c2[u]) {
    if (v == fa) continue;
    dfs3(v, u);
  }
  for (int i = 2; i <= k; ++i) {
    for (int v : c2[u]) {
      if (v == fa) continue;
      for (int j = 0; j + 2 <= i; j += 2) {
        g[u][i] = (g[u][i] + (long long)g[v][j] * g[u][i - j - 2] % mod) % mod;
      }
    }
  }
}
void dfs4(int u, int fa) {
  B[u][0] = 1;
  int t[80] = {0};
  for (int v : c2[u]) {
    for (int j = 0; j <= k; ++j) {
      if (v == fa)
        t[j] = (t[j] + g1[u][j]) % mod;
      else
        t[j] = (t[j] + g[v][j]) % mod;
    }
  }
  for (int i = 2; i <= k; ++i)
    for (int j = 0; j + 2 <= i; j += 2)
      B[u][i] = (B[u][i] + (long long)B[u][i - j - 2] * t[j] % mod) % mod;
  for (int v : c2[u]) {
    if (v == fa) continue;
    g1[v][0] = 1;
    for (int i = 2; i <= k; ++i)
      for (int j = 0; j + 2 <= i; j += 2)
        g1[v][i] = (g1[v][i] + (long long)g1[v][i - j - 2] *
                                   (t[j] - g[v][j] + mod) % mod) %
                   mod;
    dfs4(v, u);
  }
}
int main() {
  scanf("%d%d%d", &n, &m, &k);
  for (int i = 1; i < n; ++i) {
    scanf("%d%d", &u, &v);
    c1[u].push_back(v);
    c1[v].push_back(u);
  }
  for (int i = 1; i < m; ++i) {
    scanf("%d%d", &u, &v);
    c2[u].push_back(v);
    c2[v].push_back(u);
  }
  C[0][0] = 1;
  for (int i = 1; i <= lim; ++i) {
    C[i][0] = 1;
    for (int j = 1; j <= lim; ++j)
      C[i][j] = (C[i - 1][j] + C[i - 1][j - 1]) % mod;
  }
  dfs1(1, 0);
  dfs2(1, 0);
  int ans = 0;
  dfs3(1, 0);
  dfs4(1, 0);
  for (int i = 1; i <= n; ++i)
    for (int j = 1; j <= m; ++j)
      for (int l = 0; l <= k; l += 2)
        ans = (ans + (long long)A[i][l] * B[j][k - l] % mod * C[k][l] % mod) %
              mod;
  printf("%d", ans);
  return 0;
}
