#include <bits/stdc++.h>
const int Mod = 998244353;
int add(int A, int B) { return A + B >= Mod ? A + B - Mod : A + B; }
int k, C[110][110];
struct Graph {
  int Point[5010], Next[10010], To[10010], q, n;
  void Add(int u, int v) {
    Next[++q] = Point[u];
    Point[u] = q;
    To[q] = v;
    Next[++q] = Point[v];
    Point[v] = q;
    To[q] = u;
  }
  int d, f[5010][55], g[5010][55], A[55];
  void dp(int u) {
    for (int i = 1; i <= k >> 1; ++i) f[u][i] = 0;
    for (int i = 0; i <= k >> 1; ++i)
      for (int j = 0; j < i; ++j)
        f[u][i] = (f[u][i] + 1ll * f[u][j] * g[u][i - j - 1]) % Mod;
  }
  void dfs(int u, int from) {
    for (int j = Point[u]; j; j = Next[j])
      if (To[j] != from) {
        dfs(To[j], u);
        for (int i = 0; i < k >> 1; ++i) g[u][i] = add(g[u][i], f[To[j]][i]);
      }
    f[u][0] = 1;
    dp(u);
  }
  void dfs1(int u, int from) {
    if (u != from) {
      for (int i = 0; i < k >> 1; ++i) g[u][i] = add(g[u][i], f[from][i]);
      dp(u);
    }
    for (int i = 0; i <= k >> 1; ++i) A[i] = add(A[i], f[u][i]);
    for (int j = Point[u]; j; j = Next[j])
      if (To[j] != from) {
        for (int i = 0; i < k >> 1; ++i)
          g[u][i] = add(g[u][i], Mod - f[To[j]][i]);
        dp(u);
        dfs1(To[j], u);
        for (int i = 0; i < k >> 1; ++i) g[u][i] = add(g[u][i], f[To[j]][i]);
      }
    for (int i = 0; i < k >> 1; ++i) g[u][i] = add(g[u][i], Mod - f[from][i]);
    dp(u);
  }
} a, b;
int main() {
  scanf("%d %d %d", &a.n, &b.n, &k);
  if (k & 1) {
    puts("0");
    return 0;
  }
  for (int i = 1; i < a.n; ++i) {
    int u, v;
    scanf("%d %d", &u, &v);
    a.Add(u, v);
  }
  for (int i = 1; i < b.n; ++i) {
    int u, v;
    scanf("%d %d", &u, &v);
    b.Add(u, v);
  }
  a.dfs(1, 1);
  a.dfs1(1, 1);
  b.dfs(1, 1);
  b.dfs1(1, 1);
  for (int i = 0; i <= k; ++i) {
    C[i][0] = 1;
    for (int j = 1; j <= i; ++j) C[i][j] = add(C[i - 1][j - 1], C[i - 1][j]);
  }
  int ans = 0;
  for (int i = 0; i <= k >> 1; ++i)
    ans = (ans + 1ll * C[k][i << 1] * a.A[i] % Mod * b.A[(k >> 1) - i]) % Mod;
  printf("%d\n", ans);
  return 0;
}
