#include <bits/stdc++.h>
using namespace std;
int const N = 3e5 + 4, mod = 998244353, inf = 1e9 + 7;
long long n, m, k, kk, x, ans, q, b[N], y, a[N];
char ch;
string second;
vector<long long> v;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n;
  ans = n;
  for (int i = 1; i < n; i++) {
    cin >> x >> y;
    a[x]++, a[y]++;
    ans = ans * a[x] % mod * a[y] % mod;
  }
  cout << ans;
}
