#include <bits/stdc++.h>
using namespace std;
const int MOD = 998244353;
const int N = 5000;
const int M = 100;
int n[2], k;
vector<int> bi[2][N], ci[2][N];
int F[2][M][N];
int C[M][M];
int vvv[2][M];
int ans;
int visF[2][M][N * 2], valF[2][M][N * 2];
int visG[2][M][N], valG[2][M][N];
int vis[2][M][N * 2], val[2][M][N * 2];
int BB[2][N * 2];
int dfs(int p, int x, int y, int l) {
  if (l == 0) return 1;
  if (visF[p][l][y]) return valF[p][l][y];
  if (l >= 2 && !visG[p][l - 2][x]) {
    int tmp = 0;
    for (int i = 0; i < bi[p][x].size(); ++i)
      tmp = (tmp + dfs(p, bi[p][x][i], ci[p][x][i], l - 2)) % MOD;
    visG[p][l - 2][x] = 1;
    valG[p][l - 2][x] = tmp;
  }
  int res = 0;
  for (int d = 0; d + 2 <= l; d += 2)
    res = (res + 1ll * dfs(p, x, y, l - (d + 2)) *
                     (valG[p][d][x] - dfs(p, BB[p][y ^ 1], y ^ 1, d) + MOD)) %
          MOD;
  visF[p][l][y] = 1;
  return valF[p][l][y] = res;
}
int main() {
  scanf("%d%d%d", &n[0], &n[1], &k);
  if (k & 1) {
    puts("0");
    return 0;
  }
  for (int p = 0; p < 2; ++p) {
    for (int i = 1; i < n[p]; ++i) {
      int a, b;
      scanf("%d%d", &a, &b);
      bi[p][a].push_back(b);
      ci[p][a].push_back(i * 2);
      BB[p][i * 2] = b;
      bi[p][b].push_back(a);
      ci[p][b].push_back(i * 2 + 1);
      BB[p][i * 2 + 1] = a;
    }
    for (int j = 1; j <= n[p]; ++j) F[p][0][j] = 1;
    for (int l = 2; l <= k; l += 2)
      for (int x = 1; x <= n[p]; ++x)
        for (int i = 0; i < bi[p][x].size(); ++i)
          for (int d = 0; d + 2 <= l; d += 2)
            F[p][l][x] =
                (F[p][l][x] + 1ll * F[p][l - (d + 2)][x] *
                                  dfs(p, bi[p][x][i], ci[p][x][i], d)) %
                MOD;
  }
  for (int i = 0; i <= k; ++i) {
    C[i][0] = C[i][i] = 1;
    for (int j = 1; j < i; ++j) C[i][j] = (C[i - 1][j - 1] + C[i - 1][j]) % MOD;
  }
  for (int p = 0; p < 2; ++p)
    for (int i = 0; i <= k; i += 2) {
      vvv[p][i] = 0;
      for (int j = 1; j <= n[p]; ++j)
        vvv[p][i] = (vvv[p][i] + F[p][i][j]) % MOD;
    }
  for (int i = 0; i <= k; i += 2)
    ans = (ans + 1ll * vvv[0][i] * vvv[1][k - i] % MOD * C[k][i]) % MOD;
  printf("%d\n", ans);
}
