#include <bits/stdc++.h>
using namespace std;
const int mod = 998244353;
const int N = 400100;
struct edge {
  int ne, to;
} e[N];
int he[N], du[N], n, tot = 0;
long long jc[N];
void add(int x, int y) {
  e[++tot].ne = he[x];
  he[x] = tot;
  e[tot].to = y;
}
void dfs(int x, int fa) {
  for (int i = he[x]; i; i = e[i].ne) {
    int y = e[i].to;
    if (y != fa) {
      du[x]++;
      dfs(y, x);
    }
  }
}
int main() {
  int i, j, k, x, y;
  long long ans;
  scanf("%d", &n);
  tot = 0;
  for (i = 1; i < n; i++) {
    scanf("%d%d", &x, &y);
    add(x, y);
    add(y, x);
  }
  jc[0] = 1;
  for (i = 1; i <= n; i++) jc[i] = (jc[i - 1] * (long long)i) % mod;
  dfs(1, 0);
  ans = (n * jc[du[1]]) % mod;
  for (i = 2; i <= n; i++) ans = (ans * jc[du[i] + 1]) % mod;
  printf("%lld\n", ans);
  return 0;
}
