#include <bits/stdc++.h>
using namespace std;
const int N = 200000 + 10;
const int mod = 998244353;
vector<int> g[N];
int ans, f[N];
void dfs(int u, int p) {
  int x = 0;
  for (int v : g[u])
    if (v != p) dfs(v, u), x++;
  if (u == 1)
    ans = 1ll * ans * f[x] % mod;
  else
    ans = 1ll * ans * f[x + 1] % mod;
}
int main() {
  f[0] = 1;
  for (int i = 1; i < N; i++) f[i] = 1ll * f[i - 1] * i % mod;
  ios::sync_with_stdio(0);
  int n;
  cin >> n;
  for (int i = 1; i < n; i++) {
    int u, v;
    cin >> u >> v;
    g[u].push_back(v), g[v].push_back(u);
  }
  ans = n;
  dfs(1, 0);
  printf("%d\n", ans);
}
