#include <bits/stdc++.h>
using namespace std;
int64_t n, a, b, i, r = 1, p[222000];
vector<int> g[222000];
int main() {
  for (cin >> n; i < n - 1; i++)
    cin >> a >> b, g[a].push_back(b), g[b].push_back(a);
  for (p[0] = 1, a = 1; a < 200002; a++) p[a] = p[a - 1] * a, p[a] %= 998244353;
  for (r = n, a = 1; a <= n; a++) r *= p[g[a].size()], r %= 998244353;
  cout << r;
}
