#include <bits/stdc++.h>
using namespace std;
const long long N = 2e5 + 10;
long long n;
vector<long long> g[N];
long long mod = 998244353;
long long ans = 1;
long long f[N];
long long sz[N];
void init() {
  f[0] = 1;
  for (long long i = 1; i <= N - 1; i++) f[i] = f[i - 1] * i % mod;
}
long long k = 1;
void dfs(long long u, long long from) {
  ans = (ans * f[g[u].size()]) % mod, k = 0;
  for (long long v : g[u]) {
    if (v == from) continue;
    dfs(v, u);
  }
}
int32_t main() {
  init();
  ios::sync_with_stdio(0), cin.tie(0);
  cin >> n;
  for (long long i = 1; i <= n - 1; i++) {
    long long u, v;
    cin >> u >> v;
    g[u].push_back(v), g[v].push_back(u);
  }
  for (long long i = 1; i <= n; i++) {
    if (g[i].size() == 1) {
      dfs(i, -1);
      break;
    }
  }
  cout << ans * n % mod << endl;
}
