#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
using namespace std;
long long int gcd(long long int a, long long int b) {
  if (!b)
    return a;
  else
    return gcd(b, a % b);
}
vector<long long int> fact;
vector<long long int> ifact;
vector<vector<int>> adj(200005);
long long int dp[200005];
long long int add(long long int a, long long int b) {
  a += b;
  while (a >= (long long int)(998244353)) a -= (long long int)(998244353);
  return a;
}
long long int mult(long long int a, long long int b) {
  return (a * 1LL * b) % (long long int)(998244353);
}
long long int binpow(long long int a, long long int b) {
  long long int r = 1;
  while (b) {
    if (b & 1) r = mult(r, a);
    a = mult(a, a);
    b >>= 1;
  }
  return r;
}
long long int choose(long long int a, long long int b) {
  if (a < b) return 0;
  if (b == 0) return 1;
  if (a == b) return 1;
  long long int r = mult(ifact[b], ifact[a - b]);
  r = mult(r, fact[a]);
  return r;
}
long long int inv(int a) { return binpow(a, (long long int)(998244353) - 2); }
void init(long long int n) {
  fact.clear();
  ifact.clear();
  fact.resize(n + 1);
  ifact.resize(n + 1);
  ifact[0] = 1;
  fact[0] = 1;
  for (int i = 1; i <= n; i++) {
    fact[i] = mult(fact[i - 1], i);
  }
  ifact[n] = inv(fact[n]);
  for (int i = n - 1; i >= 1; i--) {
    ifact[i] = mult(ifact[i + 1], i + 1);
  }
}
long long int rchoose(long long int n, long long int r) {
  long long int res = 1;
  for (int i = 0; i < r; i++) res = mult(res, n - i);
  return res;
}
void dfs(int v, int u) {
  dp[v] = 1;
  for (int x : adj[v]) {
    if (x == u) continue;
    dfs(x, v);
    dp[v] *= dp[x];
    dp[v] %= (long long int)(998244353);
  }
  long long int sz = adj[v].size();
  dp[v] *= fact[sz];
  dp[v] %= (long long int)(998244353);
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int n;
  cin >> n;
  init(n);
  for (int i = 0; i < n - 1; i++) {
    int u, v;
    cin >> u >> v;
    u--;
    v--;
    adj[u].push_back(v);
    adj[v].push_back(u);
  }
  long long int ans = 1;
  for (int i = 0; i < n; i++) {
    long long int sz = adj[i].size();
    ans *= fact[sz];
    ans %= (long long int)(998244353);
  }
  ans *= n;
  ans %= (long long int)(998244353);
  cout << ans;
}
