#include <bits/stdc++.h>
using namespace std;
const int MOD = 998244353;
int main() {
  ios::sync_with_stdio(false), cin.tie(nullptr);
  int n, u, v, i;
  cin >> n;
  int64_t ans = n;
  vector<int> d(n + 1), f(n + 1);
  for (i = 1; i < n; ++i) cin >> u >> v, d[u]++, d[v]++;
  f[0] = 1;
  for (i = 1; i <= n; ++i) f[i] = (1LL * f[i - 1] * i) % MOD;
  for (auto it : d) ans *= f[it], ans %= MOD;
  cout << ans;
  return 0;
}
