#include <bits/stdc++.h>
using namespace std;
const int N = 200010;
int n, fact[N], u, v, sz[N];
vector<int> g[N];
int DFS(int node, int prnt) {
  int res = 1;
  for (int i = 0; i < (int)g[node].size(); i++) {
    if (g[node][i] == prnt) continue;
    res = (long long)res * DFS(g[node][i], node) % 998244353;
  }
  if (prnt == -1) {
    res = (long long)res * fact[(int)g[node].size()] % 998244353;
    res = (long long)res * n % 998244353;
  } else {
    res = (long long)res * fact[(int)g[node].size() - 1] % 998244353;
    res = (long long)res * (int)g[node].size() % 998244353;
  }
  return res;
}
int main() {
  fact[0] = 1;
  for (int i = 1; i < N; i++) fact[i] = (long long)i * fact[i - 1] % 998244353;
  scanf("%d", &n);
  for (int i = 0; i < n - 1; i++) {
    scanf("%d%d", &u, &v);
    g[u].push_back(v);
    g[v].push_back(u);
  }
  cout << DFS(1, -1) << endl;
  return 0;
}
