#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using db = double;
using pii = pair<int, int>;
using vi = vector<int>;
const int N = 4100, P = 998244353;
int n_[2], k, s[N][80], sz[N], c[80][80], Ans[2][80];
vi G_[2][N], f[N][80];
map<pii, int> to;
void solve(int typ) {
  to.clear();
  int n = n_[typ];
  vi *G = G_[typ];
  for (int i = 0; i <= n; i++) {
    sz[i] = G[i].size(), G[i].push_back(0);
    for (int j = 0; j < sz[i]; j++) to[make_pair(i, G[i][j])] = j;
    for (int j = 0; j <= k; j++)
      s[i][j] = 0, f[i][j].clear(), f[i][j].resize(sz[i] + 1, 0);
  }
  for (int i = 1; i <= n; i++)
    for (int j = 0; j <= sz[i]; j++) f[i][0][j] = 1, s[G[i][j]][0]++;
  for (int K = 2; K <= k; K++)
    for (int u = 1; u <= n; u++)
      for (int t = 0; t <= sz[u]; t++) {
        int v = G[u][t], id = v ? to[make_pair(v, u)] : 0;
        for (int j = 0; j <= K - 2; j++)
          f[u][K][t] = (f[u][K][t] + 1ll * f[u][K - j - 2][t] *
                                         (s[u][j] - f[v][j][id] + P)) %
                       P;
        s[v][K] = (s[v][K] + f[u][K][t]) % P;
      }
  for (int K = 0; K <= k; K += 2)
    for (int i = 1; i <= n; i++)
      Ans[typ][K] = (Ans[typ][K] + f[i][K][sz[i]]) % P;
}
int main() {
  scanf("%d %d %d", &n_[0], &n_[1], &k);
  if (k & 1) return puts("0"), 0;
  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]) % P;
  }
  for (int i = 1; i < n_[0]; i++) {
    int x, y;
    scanf("%d %d", &x, &y);
    G_[0][x].push_back(y), G_[0][y].push_back(x);
  }
  for (int i = 1; i < n_[1]; i++) {
    int x, y;
    scanf("%d %d", &x, &y);
    G_[1][x].push_back(y), G_[1][y].push_back(x);
  }
  solve(0), solve(1);
  int ans = 0;
  for (int i = 0; i <= k; i++)
    ans = (ans + 1ll * Ans[0][i] * Ans[1][k - i] % P * c[k][i]) % P;
  printf("%d\n", ans);
  return 0;
}
