#include <bits/stdc++.h>
using namespace std;
const int N = 200005;
const long long mod = 998244353;
int n;
vector<int> g[N];
long long ans[N];
long long first[N];
void dfs(int u, int p = -1) {
  ans[u] = 1;
  long long cnt = 0;
  for (int i = 0; i < g[u].size(); i++) {
    if (g[u][i] == p) continue;
    dfs(g[u][i], u);
    ans[u] = (ans[u] * ans[g[u][i]]) % mod;
    ans[u] = (ans[u] * (long long)g[g[u][i]].size()) % mod;
    cnt++;
  }
  ans[u] = (ans[u] * first[cnt]) % mod;
}
int main() {
  ios_base::sync_with_stdio(0);
  first[0] = 1;
  for (int i = 1; i < N; i++) first[i] = (first[i - 1] * i) % mod;
  cin >> n;
  for (int i = 0; i < n - 1; i++) {
    int a, b;
    cin >> a >> b;
    g[a].push_back(b);
    g[b].push_back(a);
  }
  dfs(1);
  cout << (n * ans[1]) % mod << endl;
}
