#include <bits/stdc++.h>
using namespace std;
const int N = int(2e5 + 5);
const int mod = int(998244353);
const double eps = 1e-9;
const double pi = 3.1415926535897932384626433832795;
vector<int> g[N];
int first[N], n;
int dfs(int v = 1, int p = 1) {
  int r = v == p ? n : g[v].size();
  r = (r * 1LL * first[g[v].size() - (v != p ? 1 : 0)]) % mod;
  for (int to : g[v]) {
    if (to != p) {
      r = (r * 1LL * dfs(to, v)) % mod;
    }
  }
  return r;
}
void solve() {
  first[0] = 1;
  scanf("%d", &n);
  for (int i = 1; i < n; i++) {
    int x, y;
    scanf("%d%d", &x, &y);
    g[x].emplace_back(y);
    g[y].emplace_back(x);
    first[i] = (first[i - 1] * 1LL * i) % mod;
  }
  printf("%d\n", dfs());
}
int main() {
  int tests = 1;
  while (tests--) {
    solve();
  }
  return 0;
}
