#include <bits/stdc++.h>
using namespace std;
const long long MD = 998244353;
int n, u, v;
vector<int> child;
vector<long long> f(1, 1);
long long res = 1;
long long factorial(int k) {
  for (int i = f.size(); i <= k; i++) f.push_back((f.back() * i) % MD);
  return f[k];
}
int main() {
  scanf("%d", &n);
  child.resize(n + 1);
  for (int i = 1; i <= n; i++) child[i] = -1;
  child[1] = 0;
  for (int i = 1; i < n; i++) {
    scanf("%d%d", &u, &v);
    child[u]++;
    child[v]++;
  }
  res = (res * factorial(child[1])) % MD;
  for (int i = 2; i <= n; i++)
    res = (res * (((child[i] + 1) * factorial(child[i])) % MD)) % MD;
  printf("%lld", (res * n) % MD);
  return 0;
}
