#include <bits/stdc++.h>
using namespace std;
template <typename T>
bool chkmx(T &x, T y) {
  return x < y ? x = y, true : false;
}
template <typename T>
bool chkmn(T &x, T y) {
  return x > y ? x = y, true : false;
}
const int maxn = 4000;
const int maxk = 75;
const int mod = 998244353;
int n1, n2, k, u, v;
int ans, c[maxk + 5][maxk + 5];
inline void red(int &x) { x -= mod, x += x >> 31 & mod; }
struct Dp {
  int n, head[maxn + 5], cnt, fa[maxn + 5];
  int f[maxn + 5][maxk + 5], g[maxn + 5][maxk + 5], h[maxn + 5][maxk + 5],
      d[maxn + 5][maxk + 5];
  int sum[maxk + 5];
  struct Edge {
    int to, next;
  } e[maxn * 2 + 5];
  void add(int u, int v) {
    e[++cnt] = (Edge){v, head[u]}, head[u] = cnt;
    e[++cnt] = (Edge){u, head[v]}, head[v] = cnt;
  }
  void dfs1(int u, int par) {
    g[u][0] = 1, fa[u] = par;
    for (int i = head[u]; i; i = e[i].next) {
      int v = e[i].to;
      if (v == par) continue;
      dfs1(v, u);
      for (int j = (2); j <= int(k); j++) red(f[u][j] += g[v][j - 2]);
    }
    for (int i = (1); i <= int(k); i++)
      for (int j = (2); j <= int(i); j++)
        red(g[u][i] += 1ll * g[u][i - j] * f[u][j] % mod);
  }
  void dfs2(int u, int par) {
    if (u != par) {
      for (int i = (2); i <= int(k); i++)
        red(h[u][i] = f[par][i] + h[par][i]), red(h[u][i] += mod - g[u][i - 2]);
      d[u][0] = 1;
      for (int i = (1); i <= int(k); i++)
        for (int j = (2); j <= int(i); j++)
          red(d[u][i] += 1ll * d[u][i - j] * h[u][j] % mod);
      for (int i = (2); i <= int(k); i++) red(h[u][i] = d[u][i - 2]);
      d[u][0] = 1;
      for (int i = (1); i <= int(k); i++) d[u][i] = 0;
      for (int i = (1); i <= int(k); i++)
        for (int j = (2); j <= int(i); j++)
          red(d[u][i] += 1ll * d[u][i - j] * h[u][j] % mod);
    }
    for (int i = head[u]; i; i = e[i].next) {
      int v = e[i].to;
      if (v == par) continue;
      dfs2(v, u);
    }
    for (int i = (0); i <= int(k); i++) red(h[u][i] += f[u][i]), g[u][i] = 0;
    g[u][0] = 1;
    for (int i = (1); i <= int(k); i++)
      for (int j = (2); j <= int(i); j++)
        red(g[u][i] += 1ll * g[u][i - j] * h[u][j] % mod);
    for (int i = (0); i <= int(k); i++) red(sum[i] += g[u][i]);
  }
  void work(int n_) {
    n = n_;
    dfs1(1, 1), dfs2(1, 1);
  }
} mjy, hlt;
int main() {
  scanf("%d%d%d", &n1, &n2, &k);
  for (int i = (1); i <= int(n1 - 1); i++) scanf("%d%d", &u, &v), mjy.add(u, v);
  for (int i = (1); i <= int(n2 - 1); i++) scanf("%d%d", &u, &v), hlt.add(u, v);
  mjy.work(n1);
  hlt.work(n2);
  c[0][0] = 1;
  for (int i = (1); i <= int(k); i++)
    for (int j = (0); j <= int(i); j++)
      red(c[i][j] += c[i - 1][j] + (!j ? 0 : c[i - 1][j - 1]));
  for (int i = (0); i <= int(k); i++)
    red(ans += 1ll * mjy.sum[i] * hlt.sum[k - i] % mod * c[k][i] % mod);
  printf("%d\n", ans);
  return 0;
}
