#include <bits/stdc++.h>
using namespace std;
long long ksm(long long a, long long b) {
  if (!b) return 1;
  long long ns = ksm(a, b >> 1);
  ns = ns * ns % 998244353;
  if (b & 1) ns = ns * a % 998244353;
  return ns;
}
long long dp[4005][80], adp[4005][80];
struct edge {
  int u, v;
  long long dp[80], adp[80];
  edge *next;
  edge *rev;
} p[4005 * 4], *h[4005];
int egcnt = 0;
void addedge(int u, int v) {
  edge *n1 = &p[egcnt++];
  n1->u = u, n1->v = v, n1->next = h[u], h[u] = n1;
  edge *n2 = &p[egcnt++];
  n2->u = v, n2->v = u, n2->next = h[v], h[v] = n2;
  n1->rev = n2, n2->rev = n1;
}
long long jc[4005], bjc[4005];
long long ns[2][4005];
long long c(int a, int b) {
  long long ans = jc[a] * bjc[b] % 998244353 * bjc[a - b] % 998244353;
  return ans;
}
int main() {
  jc[0] = bjc[0] = 1;
  for (int i = 1; i < 4005; i++)
    jc[i] = jc[i - 1] * i % 998244353,
    bjc[i] = bjc[i - 1] * ksm(i, 998244353 - 2) % 998244353;
  int n[2], k;
  scanf("%d%d%d", &n[0], &n[1], &k);
  for (int i = 0; i < 2; i++) {
    for (int j = 0; j < 4005; j++) h[j] = NULL;
    egcnt = 0;
    for (int j = 0; j < n[i] - 1; j++) {
      int u, v;
      scanf("%d%d", &u, &v);
      addedge(u, v);
    }
    for (int j = 1; j <= n[i]; j++) {
      for (edge *p = h[j]; p; p = p->next) p->adp[0] = p->dp[0] = 1;
      dp[j][0] = adp[j][0] = 1;
    }
    ns[i][0] += n[i];
    for (int nk = 2; nk <= k; nk += 2) {
      ns[i][nk] = 0;
      for (int j = 1; j <= n[i]; j++) {
        dp[j][nk] = adp[j][nk] = 0;
        for (edge *p = h[j]; p; p = p->next)
          dp[j][nk] += p->adp[nk - 2], dp[j][nk] %= 998244353;
        for (int s = 0; s <= nk - 1; s++)
          adp[j][nk] += adp[j][s] * dp[j][nk - s], adp[j][nk] %= 998244353;
        ns[i][nk] += adp[j][nk], ns[i][nk] %= 998244353;
      }
      for (int j = 1; j <= n[i]; j++)
        for (edge *p = h[j]; p; p = p->next) {
          int nv = p->v;
          p->dp[nk] = p->adp[nk] = 0;
          p->dp[nk] = dp[nv][nk] - p->rev->adp[nk - 2];
          if (p->dp[nk] < 0) p->dp[nk] += 998244353;
          for (int s = 0; s <= nk - 1; s++)
            p->adp[nk] += p->adp[s] * p->dp[nk - s], p->adp[nk] %= 998244353;
        }
    }
  }
  long long ans = 0;
  for (int i = 0; i <= k; i++) {
    long long nans = ns[0][i] * ns[1][k - i] % 998244353;
    nans *= c(k, i), nans %= 998244353;
    ans += nans, ans %= 998244353;
  }
  printf("%lld\n", ans);
  return 0;
}
