#include <bits/stdc++.h>
using namespace std;
const int N = 4e5 + 10, mod = 998244353;
int rd() {
  int x = 0, w = 1;
  char ch = 0;
  while (ch < '0' || ch > '9') {
    if (ch == '-') w = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    x = (x << 3) + (x << 1) + (ch ^ 48);
    ch = getchar();
  }
  return x * w;
}
int to[N << 1], nt[N << 1], hd[N], tot = 1;
void add(int x, int y) {
  ++tot, to[tot] = y, nt[tot] = hd[x], hd[x] = tot;
  ++tot, to[tot] = x, nt[tot] = hd[y], hd[y] = tot;
}
int n, fac[N], iac[N], sz[N], f[N];
int fpow(int a, int b) {
  int an = 1;
  while (b) {
    if (b & 1) an = 1ll * an * a % mod;
    a = 1ll * a * a % mod, b >>= 1;
  }
  return an;
}
void dfs(int x, int ffa) {
  sz[x] = f[x] = 1;
  int tt = 0;
  for (int i = hd[x]; i; i = nt[i]) {
    int y = to[i];
    if (y == ffa) continue;
    dfs(y, x), f[x] = 1ll * f[x] * f[y] % mod, sz[x] += sz[y];
    ++tt;
  }
  f[x] = 1ll * f[x] * fac[tt] % mod * (x > 1 ? tt + 1 : 1) % mod;
}
int main() {
  n = rd();
  fac[0] = 1;
  for (int i = 1; i <= n; ++i) fac[i] = 1ll * fac[i - 1] * i % mod;
  iac[n] = fpow(fac[n], mod - 2);
  for (int i = n; i; --i) iac[i - 1] = 1ll * iac[i] * i % mod;
  for (int i = 1; i < n; ++i) add(rd(), rd());
  dfs(1, 0);
  f[1] = 1ll * f[1] * n % mod;
  printf("%d\n", f[1]);
  return 0;
}
