#include <bits/stdc++.h>
#pragma comment(linker, "/stack:256000000")
using namespace std;
using ll = long long;
using ull = unsigned long long;
using ld = long double;
mt19937_64 gen(time(NULL));
ll const maxn = 3e5 + 5;
ll cnt[maxn];
ll const mod = 998244353LL;
ll fact[maxn];
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ll n;
  cin >> n;
  fact[0] = 1;
  for (ll i = 1; i < maxn; i++) {
    fact[i] = i * fact[i - 1];
    fact[i] %= mod;
  }
  ll ans = 1;
  for (ll i = 0; i < n - 1; i++) {
    ll a, b;
    cin >> a >> b;
    cnt[a]++, cnt[b]++;
  }
  for (ll i = 1; i <= n; i++) {
    ans *= fact[cnt[i]];
    ans %= mod;
  }
  cout << (ans * n) % mod << endl;
  return 0;
}
