#include <bits/stdc++.h>
using namespace std;
long long fac[200005];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n;
  cin >> n;
  vector<vector<int> > adj(n + 1, vector<int>(0));
  for (int i = 1; i < n; i++) {
    int a, b;
    cin >> a >> b;
    adj[a].push_back(b);
    adj[b].push_back(a);
  }
  fac[0] = 1;
  for (int i = 1; i <= n; i++) {
    fac[i] = (fac[i - 1] * i) % 998244353;
  }
  long long p = n;
  for (int i = 1; i <= n; i++) {
    p = (p * fac[adj[i].size()]) % 998244353;
  }
  cout << p << '\n';
}
