#include <bits/stdc++.h>
using PII = std::pair<int, int>;
using LL = long long;
using VI = std::vector<int>;
using CVI = const VI;
using VLL = std::vector<LL>;
using VVI = std::vector<VI>;
using VVLL = std::vector<VLL>;
using namespace std;
const int M = 998244353;
int n;
VVI e;
VI A, tot;
int MUL(int a, int b) { return (LL)a * b % M; }
int main() {
  ios::sync_with_stdio(false);
  cin >> n;
  A.resize(n + 1);
  tot.resize(n + 1);
  A[0] = 1;
  for (auto i = (1); i <= (n); ++i) A[i] = MUL(A[i - 1], i);
  e.resize(n + 1);
  for (int u, v, i = 0; i < n - 1; ++i) {
    cin >> u >> v;
    e[u].push_back(v);
    e[v].push_back(u);
  }
  int f = 1;
  for (auto i = (1); i <= (n); ++i) f = MUL(f, A[(int)((e[i]).size())]);
  cout << MUL(f, n) << endl;
  return 0;
}
