#include <bits/stdc++.h>
using namespace std;
const long long inf = 1e18;
const long long mod = 998244353;
vector<vector<long long> > v;
long long n;
long long step[300000];
void init() { v.resize(n); }
long long dfs(long long ver, long long pr = -1) {
  long long all = 1;
  for (auto to : v[ver]) {
    if (to == pr) continue;
    long long now = dfs(to, ver);
    all *= now;
    all %= mod;
  }
  all *= step[v[ver].size()];
  all %= mod;
  return all;
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  step[0] = 1;
  step[1] = 1;
  for (long long c = 2; c < 300000; c++) {
    step[c] = step[c - 1] * c;
    step[c] %= mod;
  }
  cin >> n;
  init();
  for (long long c = 0; c < n - 1; c++) {
    long long e, e1;
    cin >> e >> e1;
    e--;
    e1--;
    v[e].push_back(e1);
    v[e1].push_back(e);
  }
  long long answ = dfs(0);
  answ *= n;
  answ %= mod;
  cout << answ;
  return 0;
}
