#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 10;
const int mod = 998244353;
int gi() {
  int x = 0, o = 1;
  char ch = getchar();
  while ((ch < '0' || ch > '9') && ch != '-') ch = getchar();
  if (ch == '-') o = -1, ch = getchar();
  while (ch >= '0' && ch <= '9') x = x * 10 + ch - '0', ch = getchar();
  return x * o;
}
int n, deg[N];
int main() {
  cin >> n;
  for (int i = 1; i < n; i++) ++deg[gi()], ++deg[gi()];
  int ans = n;
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= deg[i]; j++) ans = 1ll * ans * j % mod;
  cout << ans;
  return 0;
}
