#include <bits/stdc++.h>
using namespace std;
vector<vector<long long>> adj;
vector<bool> visited;
long long fact[200005];
int32_t main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  long long n;
  cin >> n;
  adj.resize(n + 1);
  fact[0] = 1;
  fact[1] = 1;
  for (long long i = 2; i <= 200000; i++) {
    fact[i] = (fact[i - 1] * i) % 998244353;
  }
  for (long long i = 0; i < n - 1; i++) {
    long long u, v;
    cin >> u >> v;
    adj[u].push_back(v);
    adj[v].push_back(u);
  }
  long long ans = 1;
  ans = (fact[adj[1].size()] * n) % 998244353;
  for (long long i = 2; i <= n; i++) {
    ans = ans * fact[adj[i].size() - 1];
    ans %= 998244353;
    ans = ans * adj[i].size();
    ans %= 998244353;
  }
  cout << ans;
}
