#include <bits/stdc++.h>
using namespace std;
template <typename T>
inline void gmax(T &a, T b) {
  a = a > b ? a : b;
}
template <typename T>
inline void gmin(T &a, T b) {
  a = a < b ? a : b;
}
const int mod = 998244353;
inline int mul(int x, int y) { return (long long)x * y % mod; }
const int MAXN = 200010;
int n, ans;
int du[MAXN];
int fac[MAXN];
int main() {
  scanf("%d", &n);
  for (int i = 1; i < n; i++) {
    int x, y;
    scanf("%d%d", &x, &y);
    du[x]++;
    du[y]++;
  }
  fac[0] = 1;
  for (int i = 1; i <= n; i++) fac[i] = mul(fac[i - 1], i);
  ans = n;
  for (int i = 1; i <= n; i++) ans = mul(ans, fac[du[i]]);
  printf("%d\n", ans);
  return 0;
}
