#include <bits/stdc++.h>
using namespace std;
long long mod = 998244353;
long long fac[200010];
long long colocou[200010];
vector<int> viz[200010];
long long ans = 1;
void dfs(int u, int p = -1) {
  for (auto v : viz[u]) {
    if (v == p) continue;
    colocou[u]++, colocou[v]++;
    ans = (colocou[u] * ans) % mod;
    dfs(v, u);
  }
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  fac[0] = 1;
  for (int i = 1; i <= 200000; i++) fac[i] = (i * fac[i - 1]) % mod;
  long long n;
  cin >> n;
  for (int i = 1; i <= n - 1; i++) {
    int x, y;
    cin >> x >> y;
    viz[x].push_back(y);
    viz[y].push_back(x);
  }
  dfs(1);
  ans = (n * ans) % mod;
  cout << ans << endl;
}
