#include <bits/stdc++.h>
using namespace std;
template <class T>
T sqr(T x) {
  return x * x;
}
template <class T>
T gcd(T a, T b) {
  return b ? gcd(b, a % b) : a;
}
template <class T>
T lcm(T a, T b) {
  return a / gcd(a, b) * b;
}
template <class T>
bool isSquare(T x) {
  T y = sqrt(x + 0.5);
  return (y * y) == x;
}
template <class T1, class T2>
T1 eqMin(T1 &x, const T2 &y) {
  if (T1(y) < x) return x = y;
  return x;
}
template <class T1, class T2>
T1 eqMax(T1 &x, const T2 &y) {
  if (T1(y) > x) return x = y;
  return x;
}
template <typename T>
int sign(T val) {
  return (T(0) < val) - (val < T(0));
}
const double PI = acos(-1);
const double EPS = 1e-8;
const int INF = (int)2e9;
const unsigned long long LINF = (unsigned long long)2e18;
const long long MOD = (long long)1e9 + 7;
const int MAXN = (int)2e5 + 10;
int main() {
  ios_base::sync_with_stdio(false);
  int n;
  cin >> n;
  vector<int> degrees(n + 1);
  for (int i = 0; i < n - 1; i++) {
    int from, to;
    cin >> from >> to;
    degrees[from]++, degrees[to]++;
  }
  long long ans = n;
  for (int i = 1; i <= n; i++) {
    for (int j = 2; j <= degrees[i]; j++) {
      ans *= j;
      ans %= 998244353;
    }
  }
  cout << ans << endl;
  return 0;
}
