#include <bits/stdc++.h>
using namespace std;
int C[80][80];
void pre(int n) {
  for (int i = 0; i <= n; i++) C[i][0] = 1;
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= i; j++)
      C[i][j] = (C[i - 1][j - 1] + C[i - 1][j]) % 998244353;
}
struct Edge {
  int t, next;
  Edge() {}
  Edge(int a, int b) : t(a), next(b) {}
};
Edge e[8005];
int head[4005], k;
int f[4005][80], g[4005][80];
void merge(int *f, int *g) {
  f[0] = 1;
  for (int i = 1; i <= k; i++)
    for (int j = 1; j <= i; j++)
      f[i] = (f[i] + (long long)g[j] * f[i - j]) % 998244353;
}
int s[80], s2[80];
void dfs1(int x, int fa) {
  for (int i = head[x]; i; i = e[i].next)
    if (e[i].t != fa) dfs1(e[i].t, x);
  memset(s, 0, sizeof(s));
  for (int i = 1; i <= k; i++)
    for (int j = head[x]; j; j = e[j].next)
      if (e[j].t != fa) s[i] = (s[i] + f[e[j].t][i - 1]) % 998244353;
  merge(f[x], s);
}
int ans[4005][40];
void dfs2(int x, int fa) {
  memset(s, 0, sizeof(s));
  for (int i = 1; i <= k; i++) {
    s[i] = g[x][i - 1];
    for (int j = head[x]; j; j = e[j].next)
      if (e[j].t != fa) s[i] = (s[i] + f[e[j].t][i - 1]) % 998244353;
  }
  merge(ans[x], s);
  for (int i = head[x]; i; i = e[i].next)
    if (e[i].t != fa) {
      int u = e[i].t;
      for (int j = 1; j <= k; j++)
        s2[j] = (s[j] - f[u][j - 1] + 998244353) % 998244353;
      merge(g[u], s2);
    }
  for (int i = head[x]; i; i = e[i].next)
    if (e[i].t != fa) dfs2(e[i].t, x);
}
void solve(int n, int *s) {
  memset(head, 0, sizeof(head));
  for (int i = 1; i < n; i++) {
    int x, y;
    scanf("%d%d", &x, &y);
    e[2 * i - 1] = Edge(y, head[x]);
    head[x] = 2 * i - 1;
    e[2 * i] = Edge(x, head[y]);
    head[y] = 2 * i;
  }
  memset(f, 0, sizeof(f));
  memset(g, 0, sizeof(g));
  memset(ans, 0, sizeof(ans));
  dfs1(1, 0);
  dfs2(1, 0);
  for (int i = 0; i <= k; i++)
    for (int j = 1; j <= n; j++) s[i] = (s[i] + ans[j][i]) % 998244353;
}
int sum1[80], sum2[80];
int main() {
  int n1, n2;
  scanf("%d%d%d", &n1, &n2, &k);
  if (k & 1) {
    puts("0");
    return 0;
  }
  pre(k);
  k >>= 1;
  solve(n1, sum1);
  solve(n2, sum2);
  long long ans = 0;
  for (int i = 0; i <= k; i++)
    ans =
        (ans + (long long)sum1[i] * sum2[k - i] % 998244353 * C[2 * k][2 * i]) %
        998244353;
  printf("%I64d\n", ans);
  return 0;
}
