#include <bits/stdc++.h>
using namespace std;
long long ans = 1;
const long long MOD = 998244353;
long long num[200004];
int n;
vector<int> g[200004];
void dfs(int x, int parts) {
  int nd = 1;
  for (int i = 0; i < g[x].size(); i++)
    if (g[x][i] != parts) {
      dfs(g[x][i], x);
      nd++;
    }
  if (x == 1) nd--;
  ans = (ans * num[nd]) % MOD;
}
int main() {
  cin >> n;
  for (int i = 0; i < n - 1; i++) {
    int x, y;
    scanf("%d%d", &x, &y);
    g[x].push_back(y);
    g[y].push_back(x);
  }
  num[1] = 1;
  for (int i = 2; i <= n; i++) num[i] = (num[i - 1] * i) % MOD;
  dfs(1, -1);
  cout << (ans * n) % MOD;
}
