#include <bits/stdc++.h>
using namespace std;
const int MAX_N = 2e5 + 5;
vector<int> G[MAX_N];
long long f[MAX_N];
const long long mod = 998244353;
long long dfs(int u, int p) {
  long long res = 1;
  for (auto v : G[u])
    if (v != p) {
      res = res * dfs(v, u) % mod;
    }
  return res * f[G[u].size()] % mod;
}
int main() {
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  f[0] = 1;
  for (int i = 1; i < MAX_N; i++) f[i] = f[i - 1] * i % mod;
  for (int i = 0, a, b; i < n - 1; i++) {
    cin >> a >> b;
    G[a].push_back(b);
    G[b].push_back(a);
  }
  cout << dfs(1, 0) * n % mod << endl;
}
