#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e6 + 7;
const int inf = INT_MAX;
const long long inff = 1e18;
const long long mod = 998244353;
long long n;
long long dp[maxn];
long long p[maxn];
vector<long long> G[maxn];
void dfs(long long now, long long pp) {
  long long nn = 1;
  long long cnt = 0;
  for (long long i : G[now]) {
    if (i != pp) {
      cnt++;
      dfs(i, now);
      nn = (nn * dp[i]) % mod;
    }
  }
  if (pp != -1)
    dp[now] = (nn * p[cnt + 1]) % mod;
  else
    dp[now] = nn * p[cnt] % mod;
}
int32_t main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n;
  p[0] = 1;
  for (long long i = 1; i <= n + 1; i++) p[i] = (p[i - 1] * i) % mod;
  for (long long i = 1; i <= n - 1; i++) {
    long long x, y;
    cin >> x >> y;
    G[x].push_back(y);
    G[y].push_back(x);
  }
  dfs(1, -1);
  cout << dp[1] * n % mod << endl;
}
