#include <bits/stdc++.h>
using namespace std;
const int N = 2000003, MOD = 998244353;
int n, f[N], d[N], ans;
int main() {
  scanf("%d", &n);
  for (register int i = 1; i < n; i++) {
    int a, b;
    cin >> a >> b;
    d[a]++;
    d[b]++;
  }
  f[0] = ans = 1;
  for (register int i = 1; i <= n; i++) f[i] = (long long)i * f[i - 1] % MOD;
  for (register int i = 1; i <= n; i++) ans = (long long)ans * f[d[i]] % MOD;
  cout << (long long)ans * n % MOD << endl;
}
