#include <bits/stdc++.h>
using namespace std;
const int inf = (int)(2e9);
const long long INF = (long long)(5e18);
const int N = 300010;
const long long MOD = 998244353;
long long n, ans = 1;
vector<long long> v[N];
long long s[N];
long long P(long long x) {
  long long ret = 1;
  for (long long i = 2; i <= x; i++) ret = (ret * i) % MOD;
  return ret;
}
long long dfs(int u, int f) {
  for (int i = 0; i < (int)v[u].size(); i++) {
    int p = v[u][i];
    if (p == f) continue;
    dfs(p, u);
    s[u]++;
  }
  if (s[u] == 0) return s[u] + 1;
  if (u == 1)
    ans = (ans * P(s[u])) % MOD;
  else
    ans = (ans * (s[u] + 1) % MOD) * P(s[u]) % MOD;
  return s[u] + 1;
}
int main() {
  scanf("%lld", &n);
  for (int i = 1; i < n; i++) {
    long long x, y;
    scanf("%lld%lld", &x, &y);
    v[x].push_back(y);
    v[y].push_back(x);
  }
  memset(s, 0, sizeof(s));
  dfs(1, -1);
  printf("%lld\n", ans * n % MOD);
  return 0;
}
