#include <bits/stdc++.h>
using namespace std;
int n, m, ans, c[100][100];
int mo(int x) { return x >= 998244353 ? x - 998244353 : x; }
struct tree {
  int n, x[10000], y[10000], f[1000];
  void work() {
    for (int i = 1; i < n; i++) scanf("%d%d", &x[i], &y[i]);
    f[0] = n;
    for (int i = 1; i <= n; i++) {
      int f1[10000] = {0}, f2[10000] = {0};
      f1[i] = 1;
      for (int j = 1; j <= m; j++) {
        for (int k = 1; k < n; k++) {
          f2[x[k]] = mo(f2[x[k]] + f1[y[k]]);
          f2[y[k]] = mo(f2[y[k]] + f1[x[k]]);
        }
        for (int k = 1; k <= n; k++) f1[k] = f2[k], f2[k] = 0;
        f[j] = mo(f[j] + f1[i]);
      }
    }
  }
} t1, t2;
int main() {
  scanf("%d%d%d", &t1.n, &t2.n, &m);
  t1.work();
  t2.work();
  for (int i = 0; i <= m; i++) {
    c[i][0] = 1;
    for (int j = 1; j <= i; j++) c[i][j] = mo(c[i - 1][j - 1] + c[i - 1][j]);
  }
  for (int i = 0; i <= m; i++)
    ans =
        mo(ans + 1ll * t1.f[i] * t2.f[m - i] % 998244353 * c[m][i] % 998244353);
  printf("%d", ans);
}
