#include <bits/stdc++.h>
using namespace std;
const long long N = 2e5 + 7, MOD = 998244353;
long long first[N], dp[N];
vector<long long> g[N];
void dfs(long long u, long long p) {
  long long k = 0;
  for (long long v : g[u])
    if (v != p) {
      dfs(v, u);
      ++k;
    }
  if (k == 0) {
    dp[u] = 1;
  } else {
    dp[u] = first[k] * (k + 1) % MOD;
    for (long long v : g[u])
      if (v != p) dp[u] = dp[u] * dp[v] % MOD;
  }
}
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  first[0] = 1;
  for (long long i = 1; i < N; ++i) first[i] = first[i - 1] * i % MOD;
  long long n;
  cin >> n;
  if (n == 2) {
    cout << "2\n";
    exit(0);
  }
  for (long long i = 0; i < n - 1; ++i) {
    long long u, v;
    cin >> u >> v;
    g[u].push_back(v);
    g[v].push_back(u);
  }
  long long root = -1;
  for (long long i = 1; i <= n; ++i)
    if (g[i].size() > 1) root = i;
  dfs(root, root);
  long long ans = 1;
  for (long long v : g[root]) ans = ans * dp[v] % MOD;
  ans = ans * first[g[root].size()] % MOD;
  ans = ans * n % MOD;
  cout << ans << '\n';
}
