#include <bits/stdc++.h>
using namespace std;
const int mod = 998244353;
long long f[200005];
int deg[200005];
int main() {
  f[0] = 1;
  for (int i = 1; i <= 200000; i++) f[i] = (f[i - 1] * i) % mod;
  int n;
  scanf("%d", &n);
  for (int i = 1; i <= n - 1; i++) {
    int a, b;
    scanf("%d%d", &a, &b);
    deg[a]++;
    deg[b]++;
  }
  long long ans = n;
  for (int i = 1; i <= n; i++) ans = (ans * f[deg[i]]) % mod;
  printf("%lld\n", ans);
}
