#include <bits/stdc++.h>
using namespace std;
const int N = 200005;
const int mod = 998244353;
int n;
int deg[N];
int fac[N];
int main() {
  cin >> n;
  fac[0] = 1;
  for (int i = 1; i <= n; i++) {
    fac[i] = (1ll * fac[i - 1] * i) % mod;
  }
  for (int i = 1; i < n; i++) {
    int x, y;
    cin >> x >> y;
    deg[x]++;
    deg[y]++;
  }
  int ans = n;
  for (int i = 1; i <= n; i++) {
    ans = (1ll * ans * fac[deg[i]]) % mod;
  }
  cout << ans << endl;
  return 0;
}
