#include <bits/stdc++.h>
using namespace std;
int main() {
  const int MOD = 998244353;
  int n;
  cin >> n;
  long long ans = n;
  int a[n + 1];
  for (int v = 1; v <= n; v++) a[v] = 0;
  n = (n - 1) * 2;
  for (int _ = 0; _ < n; ++_) {
    int v;
    cin >> v;
    ans = (ans * ++a[v]) % MOD;
  }
  cout << ans << '\n';
  return 0;
}
