#include <bits/stdc++.h>
using namespace std;
long long fact[200006];
map<long long, long long> child;
map<long long, list<long long>> adj;
long long answer = 1;
void solve(long long node, long long par) {
  long long count = 0;
  for (auto part : adj[node]) {
    if (part == par) continue;
    count++;
    solve(part, node);
  }
  if (node == 1)
    answer = ((answer * fact[count]) % 998244353);
  else
    answer = (answer * fact[count + 1]) % 998244353;
}
int32_t main() {
  fact[0] = 1;
  fact[1] = 1;
  for (long long i = 2; i < 200006; i++)
    fact[i] = (i * fact[i - 1]) % 998244353;
  long long n;
  cin >> n;
  for (long long i = 0; i < n - 1; ++i) {
    long long x, y;
    cin >> x >> y;
    adj[x].push_back(y);
    adj[y].push_back(x);
  }
  solve(1, -1);
  answer = (answer * (n)) % 998244353;
  cout << answer << endl;
}
