#include <bits/stdc++.h>
using namespace std;
const int inf = 0x3f3f3f3f;
inline long long read() {
  long long x = 0, f = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    x = (x << 1) + (x << 3) + (ch ^ 48);
    ch = getchar();
  }
  return x * f;
}
long long die = 0;
const double eps = 1e-8;
const long long mod = 998244353;
const long long N1 = 1e6 + 5;
const long long N2 = 1e5 + 5;
long long n;
std::vector<long long> G[N1];
long long sum[N1];
long long fac[N1];
long long dfs(long long u, long long fa) {
  long long ans = fac[G[u].size()];
  for (long long v : G[u]) {
    if (v == fa) continue;
    (ans *= dfs(v, u)) %= mod;
  }
  return ans;
}
void sol1() {
  fac[0] = 1;
  for (long long i = (1); i <= (n); i++) fac[i] = fac[i - 1] * i % mod;
  long long ans = dfs(1, 1) * n % mod;
  cout << ans;
}
void rd() {
  n = read();
  long long x, y;
  for (long long i = (1); i <= (n - 1); i++) {
    x = read(), y = read();
    G[x].push_back(y), G[y].push_back(x);
  }
  sol1();
}
signed main() { rd(); }
