#include <bits/stdc++.h>
using namespace std;
long long fact(int a) {
  long long res = 1;
  for (int i = 2; i <= a; i++) res = (res * i) % 998244353;
  return res;
}
int main() {
  long long n;
  cin >> n;
  vector<vector<int> > rels;
  vector<int> tmp;
  rels.assign(n, tmp);
  for (int i = 1; i < n; i++) {
    long long u, v;
    cin >> u >> v;
    rels[--u].push_back(--v);
    rels[v].push_back(u);
  }
  long long res = n;
  for (int i = 0; i < n; i++) res = (res * fact(rels[i].size())) % 998244353;
  cout << res;
}
