#include <bits/stdc++.h>
using namespace std;
int n, m, q, cnt, ans;
int x1[4010], r[2 * 4010], vt[2 * 4010], now, w[2][80], cc[80][80];
int f[4010][80], g[4010][80], su[4010], l[4010], t, t1, fa[4010];
bool vi[4010];
void add(int &a, int b) {
  a += b;
  if (a >= 998244353) a -= 998244353;
}
void adde(int a, int b) {
  r[++cnt] = x1[a];
  x1[a] = cnt;
  vt[cnt] = b;
  r[++cnt] = x1[b];
  x1[b] = cnt;
  vt[cnt] = a;
}
int ff(int k) {
  int i, s, a, b, j, c, mx;
  fa[l[t = t1 = 1] = k] = 0;
  while (t <= t1) {
    a = x1[s = l[t++]];
    while (a) {
      b = vt[a];
      if (b != fa[s] && !vi[b]) fa[l[++t1] = b] = s;
      a = r[a];
    }
  }
  mx = 1e9;
  for (i = t1; i; i--) {
    a = x1[s = l[i]];
    su[s] = 1;
    c = 0;
    while (a) {
      b = vt[a];
      if (b != fa[s] && !vi[b]) c = max(c, su[b]), su[s] += su[b];
      a = r[a];
    }
    c = max(c, t1 - su[s]);
    if (c < mx) mx = c, j = s;
  }
  return j;
}
void cal(int k) {
  int i, s, a, b, j;
  for (i = 1; i <= t1; i++)
    for (s = 0, a = l[i]; s <= q; s++) f[a][s] = g[a][s] = 0;
  f[k][0] = g[k][0] = 1;
  a = x1[k];
  for (i = 0; i < q; i++)
    for (s = 0; s <= t1; s++) {
      a = x1[j = l[s]];
      while (a) {
        b = vt[a];
        if (!vi[b]) {
          if (b != k) add(f[b][i + 1], f[j][i]);
          add(g[b][i + 1], g[j][i]);
        }
        a = r[a];
      }
    }
  for (k = 1; k <= t1; k++)
    for (i = 0, a = l[k]; i <= q; i++)
      for (s = 0; s + i <= q; s++)
        add(w[now][i + s], (long long)f[a][i] * g[a][s] % 998244353);
}
void work(int k) {
  int a, b;
  cal(k = ff(k));
  vi[k] = 1;
  a = x1[k];
  while (a) {
    b = vt[a];
    if (!vi[b]) work(b);
    a = r[a];
  }
}
int main() {
  int i, s, a, b, j, k;
  scanf("%d%d%d", &n, &m, &q);
  if (q & 1) {
    printf("0");
    return 0;
  }
  for (i = 1; i < n; i++) scanf("%d%d", &a, &b), adde(a, b);
  work(1);
  now = 1;
  cnt = 0;
  for (i = 1; i <= m; i++) x1[i] = vi[i] = 0;
  for (i = 1; i < m; i++) scanf("%d%d", &a, &b), adde(a, b);
  work(1);
  for (i = 0; i <= q; i++) {
    cc[i][i] = cc[i][0] = 1;
    for (s = 1; s < i; s++) add(cc[i][s] = cc[i - 1][s - 1], cc[i - 1][s]);
  }
  for (i = 0; i <= q; i++)
    add(ans,
        (long long)w[0][i] * w[1][q - i] % 998244353 * cc[q][i] % 998244353);
  printf("%d", ans);
  return 0;
}
