#include <bits/stdc++.h>
using namespace std;
int n1, n2, k;
int g[4010][76], cnt1[76], cnt2[76], Ps[4010][4010], sum[4010];
vector<int> f[4010][76];
vector<int> T1[4010], T2[4010];
int mul(int a, int b) { return 1ll * a * b % 998244353; }
void add(int &x, int y) {
  x += y;
  if (x >= 998244353) x -= 998244353;
}
void solve(vector<int> T[], int cnt[], int n) {
  for (int i = (1); i <= (n); i++)
    for (int j = (0); j <= (k); j++) f[i][j].resize((int)(T[i].size()));
  for (int x = (1); x <= (n); x++)
    for (int p = (0); p <= ((int)(T[x].size()) - 1); p++) {
      Ps[T[x][p]][x] = p;
      f[x][0][p] = 1;
    }
  for (int l = (1); l <= (k); l++)
    for (int x = (1); x <= (n); x++) {
      for (int j = (0); j <= (l); j++) {
        sum[j] = 0;
        for (auto p : T[x]) add(sum[j], f[p][j][Ps[x][p]]);
      }
      for (int p = (0); p <= ((int)(T[x].size()) - 1); p++) {
        int tx = T[x][p];
        f[x][l][p] = 0;
        for (int t = (0); t <= (l - 2); t++)
          add(f[x][l][p],
              mul(f[x][l - 2 - t][p],
                  (sum[t] + 998244353 - f[tx][t][Ps[x][tx]]) % 998244353));
      }
    }
  for (int i = (1); i <= (n); i++) g[i][0] = 1;
  for (int l = (1); l <= (k); l++) {
    for (int x = (1); x <= (n); x++) {
      g[x][l] = 0;
      for (auto p : T[x])
        for (int j = (0); j <= (l - 2); j++)
          add(g[x][l], mul(f[p][j][Ps[x][p]], g[x][l - j - 2]));
    }
  }
  for (int i = (1); i <= (n); i++)
    for (int j = (0); j <= (k); j++) add(cnt[j], g[i][j]);
}
int comb[76][76];
void initcomb() {
  comb[0][0] = 1;
  for (int i = (1); i <= (76 - 1); i++) {
    comb[i][0] = 1;
    for (int j = (1); j <= (76 - 1); j++)
      comb[i][j] = (comb[i - 1][j - 1] + comb[i - 1][j]) % 998244353;
  }
}
int main() {
  initcomb();
  cin >> n1 >> n2 >> k;
  int x, y;
  for (int i = (1); i <= (n1 - 1); i++) {
    scanf("%d%d", &x, &y);
    T1[x].push_back(y), T1[y].push_back(x);
  }
  for (int i = (1); i <= (n2 - 1); i++) {
    scanf("%d%d", &x, &y);
    T2[x].push_back(y), T2[y].push_back(x);
  }
  solve(T1, cnt1, n1);
  solve(T2, cnt2, n2);
  long long ans = 0;
  for (int i = (0); i <= (k); i++)
    ans += mul(comb[k][i], mul(cnt1[i], cnt2[k - i]));
  cout << ans % 998244353 << endl;
}
