#include <bits/stdc++.h>
using namespace std;
const int INF = 0x3f3f3f3f;
const long long INFF = 0x3f3f3f3f3f3f3f3fll;
const long long M = 998244353;
const long long maxn = 1e6 + 7;
const double pi = acos(-1.0);
const double eps = 0.00000001;
long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; }
template <typename T>
inline T abs(T a) {
  return a > 0 ? a : -a;
}
template <typename T>
inline T powMM(T a, T b) {
  T ret = 1;
  for (; b; b >>= 1ll, a = (long long)a * a % M)
    if (b & 1) ret = (long long)ret * a % M;
  return ret;
}
inline void add(long long &x, long long y) {
  x += y;
  (x >= M) && (x -= M);
}
int k;
int A[maxn];
vector<int> edge[maxn];
int sz[maxn];
bool mark[maxn];
int minweight, root;
void dfs1(int x, int fa, int n) {
  int weight = 0;
  sz[x] = 1;
  for (int v : edge[x]) {
    if (v == fa || mark[v]) continue;
    dfs1(v, x, n);
    sz[x] += sz[v];
    weight = max(weight, sz[v]);
  }
  weight = max(weight, n - sz[x]);
  if (weight < minweight) root = x, minweight = weight;
}
vector<int> have;
long long nowans[157];
long long F[4007][157], G[4007][157];
void dfs2(int x, int fa) {
  int i, j;
  have.push_back(x);
  for (int v : edge[x]) {
    if (v == fa || mark[v]) continue;
    dfs2(v, x);
  }
}
void calc(int x) {
  int i, j;
  have.clear();
  dfs2(x, 0);
  for (i = 0; i <= k * 2; i++)
    for (int x : have) F[x][i] = G[x][i] = 0;
  G[x][0] = 1;
  F[x][0] = 1;
  for (i = 0; i <= k * 2 - 1; i++)
    for (int y : have)
      for (int v : edge[y])
        if (!mark[v]) {
          add(G[v][i + 1], G[y][i]);
          if ((y != x || !i) && v != x) add(F[v][i + 1], F[y][i]);
        }
  for (int y : have) {
    for (i = 0; i <= k * 2; i++)
      for (j = 0; j <= k * 2; j++) add(nowans[i + j], F[y][i] * G[y][j] % M);
  }
}
void dfs3(int x) {
  calc(x);
  mark[x] = 1;
  for (int v : edge[x]) {
    if (mark[v]) continue;
    minweight = sz[v];
    dfs1(v, 0, sz[v]);
    dfs3(root);
  }
}
long long ans_1[107], ans_2[107];
long long inv[1000002];
long long fac[1000002];
long long C(int n, int m) { return fac[n] * inv[m] % M * inv[n - m] % M; }
void solve_cnt(int n, long long ans[]) {
  int i, j, x, y;
  for (i = 1; i <= n - 1; i++) {
    int u, v;
    scanf("%d%d", &u, &v);
    edge[u].push_back(v);
    edge[v].push_back(u);
  }
  for (i = 0; i <= k; i++) nowans[i] = 0;
  minweight = n;
  dfs1(1, 0, n);
  dfs3(root);
  for (i = 0; i <= k; i++) ans[i] = nowans[i * 2], nowans[i * 2] = 0;
  for (i = 1; i <= n; i++) edge[i].clear(), mark[i] = 0;
}
int TaskA() {
  int m, i, j;
  int n1, n2;
  scanf("%d%d%d", &n1, &n2, &k);
  if (k & 1) return 0 * puts("0");
  k /= 2;
  solve_cnt(n1, ans_1);
  solve_cnt(n2, ans_2);
  long long ans = 0;
  for (i = 0; i <= k; i++)
    ans += C(k * 2, i * 2) * ans_1[i] % M * ans_2[k - i] % M;
  ans %= M;
  printf("%I64d\n", ans);
  return 0;
}
void initialize() {
  int i;
  fac[0] = 1;
  for (i = 1; i <= 1000000; i++) fac[i] = i * fac[i - 1] % M;
  inv[0] = inv[1] = 1;
  for (i = 2; i <= 1000000; i++) inv[i] = (M - M / i) * inv[M % i] % M;
  for (i = 1; i <= 1000000; i++) inv[i] = inv[i] * inv[i - 1] % M;
}
int main() {
  int startTime = clock();
  initialize();
  fprintf(stderr, "/--- initializeTime: %ld milliseconds ---/\n",
          clock() - startTime);
  int T = 1;
  startTime = clock();
  while (T--) TaskA();
  fprintf(stderr, "/--- computeTime: %ld milliseconds ---/\n",
          clock() - startTime);
}
