#include <bits/stdc++.h>
using namespace std;
int32_t main() {
  ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  long long n, mod = 998244353;
  cin >> n;
  vector<long long> v[n + 2];
  for (long long i = (long long)(1); i <= (long long)(n - 1); i++) {
    long long x, y;
    cin >> x >> y;
    v[x].push_back(y);
    v[y].push_back(x);
  }
  long long fac[n + 2];
  fac[0] = 1;
  for (long long i = (long long)(1); i <= (long long)(n); i++)
    fac[i] = fac[i - 1] * i % mod;
  long long ans = n;
  for (long long i = (long long)(1); i <= (long long)(n); i++)
    ans = ans * (fac[v[i].size()]) % mod;
  cout << ans;
}
