#include <bits/stdc++.h>
using namespace std;
const long long NR = 4e5 + 10, oo = 2e9 + 10, MOD = 998244353;
const long double pi = 2 * acos(0.0);
long long n;
long long v[NR];
long long fact[NR];
signed main() {
  long long i, j, x, y;
  cin >> n;
  for (i = 1; i < n; ++i) {
    cin >> x >> y;
    v[x]++;
    v[y]++;
  }
  fact[0] = 1;
  for (i = 1; i <= n; ++i) {
    fact[i] = fact[i - 1] * i % MOD;
  }
  long long ans = n;
  for (i = 1; i <= n; ++i) {
    ans *= fact[v[i]];
    ans %= MOD;
  }
  cout << ans << '\n';
  return 0;
}
