#include <bits/stdc++.h>
using namespace std;
const int N = 3e5 + 5;
const long long mod = 998244353;
int n, deg[N];
long long f[N];
int main() {
  ios::sync_with_stdio(false);
  cin >> n;
  int x, y;
  f[1] = 1;
  for (int i = 2; i <= n; i++) {
    cin >> x >> y;
    deg[x]++;
    deg[y]++;
    f[i] = f[i - 1] * i % mod;
  }
  long long ans = n;
  for (int i = 1; i <= n; i++) {
    ans = ans * f[deg[i]] % mod;
  }
  cout << ans << endl;
}
