#include <bits/stdc++.h>
using namespace std;
int dx[] = {0, 1, 0, -1};
int dy[] = {1, 0, -1, 0};
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  int t = 1;
  while (t--) {
    int n, mod = 998244353;
    cin >> n;
    long long dp[200001];
    dp[1] = 1;
    for (long long i = 2; i < 200001; i++) {
      dp[i] = (dp[i - 1] * i) % mod;
    }
    vector<long long> adj[n + 1];
    for (long long i = 0; i < n - 1; i++) {
      int a, b;
      cin >> a >> b;
      adj[a].push_back(b);
      adj[b].push_back(a);
    }
    long long ans = n;
    for (long long i = 1; i <= n; i++) {
      ans = (ans * dp[adj[i].size()]) % mod;
    }
    cout << ans;
  }
}
