#include <bits/stdc++.h>
using namespace std;
long long mod = 998244353;
vector<vector<int> > s;
vector<int> p;
vector<long long> fact;
long long ans(int no) {
  if (s[no].size() == 0)
    return 1;
  else {
    long long cans = fact[s[no].size()];
    if (no) cans = (cans * (s[no].size() + 1)) % mod;
    for (int son : s[no]) cans = (cans * ans(son)) % mod;
    return cans;
  }
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int n, u, v;
  cin >> n;
  vector<vector<int> > gr(n);
  for (int i = 1; i < n; i++) {
    cin >> u >> v;
    gr[--u].push_back(--v);
    gr[v].push_back(u);
  }
  p.resize(n);
  p[0] = -1;
  s.assign(n, vector<int>());
  queue<int> bfs;
  bfs.push(0);
  while (!bfs.empty()) {
    int no = bfs.front();
    bfs.pop();
    for (int ne : gr[no]) {
      if (ne != p[no]) {
        s[no].push_back(ne);
        p[ne] = no;
        bfs.push(ne);
      }
    }
  }
  fact.resize(n + 1);
  fact[0] = fact[1] = 1;
  for (long long i = 2; i <= n; i++) fact[i] = (fact[i - 1] * i) % mod;
  cout << (ans(0) * n) % mod << '\n';
  return 0;
}
