#include <bits/stdc++.h>
using namespace std;
const long long int mod = 998244353;
long long int t, n, m, a[1000005] = {0}, fact[1000005] = {0},
                       deg[1000005] = {0};
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  cout.tie(NULL);
  long long int i, j, k, x, y;
  cin >> n;
  fact[0] = 1;
  for (i = 1; i < 1000005; i++) fact[i] = (fact[i - 1] * i) % mod;
  for (i = 1; i < n; i++) {
    cin >> x >> y;
    deg[x]++;
    deg[y]++;
  }
  long long int ans = n;
  for (i = 1; i <= n; i++) ans = (ans * fact[deg[i]]) % mod;
  cout << ans;
  cerr << '\n'
       << "Time elapsed :" << clock() * 1000.0 / CLOCKS_PER_SEC << " ms\n";
  return 0;
}
