#include <bits/stdc++.h>
inline long long read() {
  long long x = 0;
  char ch = getchar(), w = 1;
  while (ch < '0' || ch > '9') {
    if (ch == '-') w = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    x = x * 10 + ch - '0';
    ch = getchar();
  }
  return x * w;
}
void write(long long x) {
  if (x < 0) putchar('-'), x = -x;
  if (x > 9) write(x / 10);
  putchar(x % 10 + '0');
}
inline void writeln(long long x) {
  write(x);
  puts("");
}
using namespace std;
const int N = 3e5;
int n;
const long long p = 998244353;
long long fac[N], d[N];
int main() {
  n = read();
  for (int i = 1; i < n; ++i) {
    int x = read(), y = read();
    ++d[x], ++d[y];
  }
  fac[0] = 1;
  for (int i = 1; i <= n; ++i) fac[i] = fac[i - 1] * i % p;
  long long ans = 1;
  for (int i = 1; i <= n; ++i) ans = ans * fac[d[i]] % p;
  ans = ans * n % p;
  writeln(ans);
  return 0;
}
