#include <bits/stdc++.h>
using namespace std;
mt19937 rng32(chrono::steady_clock::now().time_since_epoch().count());
long long modExpo(long long x, long long n) {
  if (n == 0)
    return 1;
  else if (n % 2 == 0)
    return modExpo((x * x) % 998244353, n / 2);
  else
    return (x * modExpo((x * x) % 998244353, (n - 1) / 2)) % 998244353;
}
long long modInverse(long long n) { return modExpo(n, 1000000007 - 2); }
long long n, m, k, ar[300010], dp[300010], sz[300010], fact[300010];
string s, s1;
vector<long long> adj[300010];
void dfs(long long ver, long long par) {
  sz[ver] = 1;
  for (auto i : adj[ver]) {
    if (i != par) {
      dfs(i, ver);
      sz[ver] += sz[i];
    }
  }
}
void dfs1(long long ver, long long par) {
  dp[ver] = 1;
  long long cnt = 1;
  for (auto i : adj[ver]) {
    if (i != par) {
      cnt++;
      dfs1(i, ver);
      dp[ver] = (dp[i] * dp[ver]) % 998244353;
    }
  }
  dp[ver] = (dp[ver] * fact[cnt]) % 998244353;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int ti = 1;
  while (ti--) {
    fact[0] = 1;
    for (long long i = 1; i < 300010; i++)
      fact[i] = (fact[i - 1] * i) % 998244353;
    cin >> n;
    for (long long i = 0; i < n - 1; i++) {
      long long x, y;
      cin >> x >> y;
      adj[x].push_back(y);
      adj[y].push_back(x);
    }
    dfs(1, 1);
    long long ans = n;
    long long cnt = 0;
    for (auto i : adj[1]) {
      dfs1(i, 1);
      ans = (ans * dp[i]) % 998244353;
      cnt++;
    }
    ans = (ans * fact[cnt]) % 998244353;
    cout << ans;
  }
  return 0;
}
