#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vll = vector<ll>;
using vii = vector<int>;
using pii = pair<int, int>;
template <typename T = vii>
using vec = vector<T>;
const ll INF = 1e18, MOD = 998244353;
const int MAX = 1e6;
ll ft[MAX + 1];
void cf() {
  ft[0] = 1;
  for (int i = 1; i <= MAX; i++) {
    ft[i] = (i * ft[i - 1]) % MOD;
  }
}
int main() {
  cin.tie(NULL);
  ios_base::sync_with_stdio(false);
  cf();
  int n;
  cin >> n;
  unordered_map<int, int> cnt;
  for (int i = 1; i < n; i++) {
    int u, v;
    cin >> u >> v;
    u--, v--;
    cnt[u]++;
    cnt[v]++;
  }
  ll res = 1;
  for (auto p : cnt) {
    (res *= ft[p.second]) %= MOD;
  }
  cout << (n * res) % MOD << '\n';
}
