#include <bits/stdc++.h>
using namespace std;
const long long mod = 998244353;
const long long inf = 1ll << 61;
struct edge {
  long long to;
  long long cost;
};
long long dis[200006];
long long chd[200006];
vector<long long> G[200006];
vector<long long> G1[200006];
long long kj[200006];
long long A[200006], B[200006];
long long modpow(long long x, long long n, long long md) {
  if (!n) return 1;
  long long res = modpow(x * x % md, n / 2, md);
  if (n & 1) res = res * x % md;
  return res;
}
void dfs1(long long n) {
  for (long long i = 0; i < G[n].size(); i++) {
    if (dis[G[n][i]] == -1) {
      dis[G[n][i]] = dis[n] + 1;
      dfs1(G[n][i]);
    }
  }
}
long long ans;
void dfs(long long n) {
  if (n == 0)
    ans *= kj[chd[n]];
  else
    ans *= kj[chd[n] + 1];
  ans %= mod;
  for (long long i = 0; i < G1[n].size(); i++) {
    dfs(G1[n][i]);
  }
  return;
}
signed main() {
  long long n;
  cin >> n;
  for (long long i = 0; i < n - 1; i++) {
    long long a, b;
    cin >> a >> b;
    a--;
    b--;
    G[a].push_back(b);
    G[b].push_back(a);
    A[i] = a;
    B[i] = b;
  }
  fill(dis, dis + n, -1);
  dis[0] = 0;
  dfs1(0);
  kj[0] = 1;
  for (long long i = 1; i <= n; i++) kj[i] = kj[i - 1] * i % mod;
  for (long long i = 0; i < n - 1; i++) {
    if (dis[A[i]] > dis[B[i]]) {
      G1[B[i]].push_back(A[i]);
    } else
      G1[A[i]].push_back(B[i]);
  }
  for (long long i = 0; i < n; i++) chd[i] = G1[i].size();
  ans = n;
  dfs(0);
  cout << ans << endl;
}
