#include <bits/stdc++.h>
using namespace std;
const long long inf = (long long)1e18;
const long long mod = 998244353;
const double eps = (double)1e-9;
const double pi = acos(-1.0);
const int dx[] = {0, 0, 1, 0, -1};
const int dy[] = {0, 1, 0, -1, 0};
const int N = 300500;
int n;
long long first[N], dp[N];
vector<int> g[N];
long long dfs(int v, int pr = -1) {
  dp[v] = 1;
  int cnt = 0;
  long long ans = 1;
  for (int i : g[v]) {
    if (i == pr) continue;
    ans *= dfs(i, v);
    ans %= mod;
    dp[v] += dp[i];
    cnt++;
  }
  if (v == 1) {
    return n * ans % mod * first[cnt] % mod;
  }
  return ans * first[cnt + 1] % mod;
}
int main() {
  cin.tie(NULL);
  cout.tie(NULL);
  ios_base::sync_with_stdio(false);
  first[0] = 1;
  for (int i = 1; i <= 200000; ++i) first[i] = first[i - 1] * i % mod;
  cin >> n;
  for (int i = 1; i < n; ++i) {
    int x, y;
    cin >> x >> y;
    g[x].push_back(y);
    g[y].push_back(x);
  }
  cout << dfs(1) % mod;
  return 0;
}
