#include <bits/stdc++.h>
using namespace std;
int N;
vector<int> adj[200005];
long long fac[200005];
int main() {
  cin >> N;
  int u, v;
  for (int i = 1; i < N; i++) {
    cin >> u >> v;
    adj[u].push_back(v);
    adj[v].push_back(u);
  }
  fac[0] = 1;
  for (int i = 1; i <= N; i++) {
    fac[i] = fac[i - 1] * i % int(998244353);
  }
  long long ans = N;
  for (int i = 1; i <= N; i++) {
    ans = ans * fac[adj[i].size()] % int(998244353);
  }
  cout << ans << endl;
  return 0;
}
