#include <bits/stdc++.h>
using namespace std;
int const mod = 998244353;
long long fac[2000001];
int main() {
  int n;
  cin >> n;
  vector<int> v[n];
  vector<int> tmp;
  int u, m;
  long long ans = 1;
  fac[0] = 1;
  for (int i = 1; i < 2000001; i++) {
    fac[i] = fac[i - 1] * i;
    fac[i] %= mod;
  }
  for (int i = 0; i < n - 1; i++) {
    cin >> u >> m;
    v[u - 1].push_back(m);
    v[m - 1].push_back(u);
  }
  for (int i = 0; i < n; i++) {
    ans *= fac[v[i].size()];
    ans %= mod;
  }
  ans *= n;
  ans %= mod;
  cout << ans;
}
