#include <bits/stdc++.h>
using namespace std;
struct ModResidue {
  constexpr static long long P = 998244353;
  long long x;
  ModResidue() = default;
  ModResidue(long long _x) : x(_x % P) {}
};
ModResidue operator*(const ModResidue a, const ModResidue b) {
  return a.x * b.x;
}
ModResidue& operator*=(ModResidue& a, const ModResidue b) { return a = a * b; }
int main() {
  int n;
  cin >> n;
  vector<int> degrees(n);
  for (int i = 0; i < n - 1; i++) {
    int u, v;
    cin >> u >> v;
    u--;
    v--;
    degrees[u]++;
    degrees[v]++;
  }
  vector<ModResidue> factorial(n + 1);
  factorial[0] = 1;
  for (int i = 1; i <= n; i++) {
    factorial[i] = i * factorial[i - 1];
  }
  ModResidue answer = n;
  for (int v = 0; v < n; v++) {
    answer *= factorial[degrees[v]];
  }
  cout << answer.x << endl;
}
