#include <bits/stdc++.h>
using namespace std;
struct mint {
  typedef decay<decltype(998244353)>::type T;
  T v;
  explicit operator T() const { return v; }
  mint() { v = 0; }
  mint(long long _v) {
    v = (-998244353 < _v && _v < 998244353) ? _v : _v % 998244353;
    if (v < 0) v += 998244353;
  }
  friend bool operator==(const mint& a, const mint& b) { return a.v == b.v; }
  friend bool operator!=(const mint& a, const mint& b) { return !(a == b); }
  friend bool operator<(const mint& a, const mint& b) { return a.v < b.v; }
  mint& operator+=(const mint& m) {
    if ((v += m.v) >= 998244353) v -= 998244353;
    return *this;
  }
  mint& operator-=(const mint& m) {
    if ((v -= m.v) < 0) v += 998244353;
    return *this;
  }
  mint& operator*=(const mint& m) {
    v = (long long)v * m.v % 998244353;
    return *this;
  }
  mint& operator/=(const mint& m) { return (*this) *= inv(m); }
  friend mint pow(mint a, long long p) {
    mint ans = 1;
    assert(p >= 0);
    for (; p; p /= 2, a *= a)
      if (p & 1) ans *= a;
    return ans;
  }
  friend mint inv(const mint& a) {
    assert(a.v != 0);
    return pow(a, 998244353 - 2);
  }
  mint operator-() const { return mint(-v); }
  mint& operator++() { return *this += 1; }
  mint& operator--() { return *this -= 1; }
  friend mint operator+(mint a, const mint& b) { return a += b; }
  friend mint operator-(mint a, const mint& b) { return a -= b; }
  friend mint operator*(mint a, const mint& b) { return a *= b; }
  friend mint operator/(mint a, const mint& b) { return a /= b; }
};
vector<mint> fact;
void bincoeff(long long n) {
  fact.resize(n + 1);
  fact[0] = 1;
  for (long long i = 1; i <= n; i++) {
    fact[i] = fact[i - 1] * i;
  }
}
mint ncr(long long n, long long r) {
  if ((n < 0) || (r < 0) || ((n - r) < 0)) return 0;
  return (fact[n] / (fact[n - r] * fact[r]));
}
vector<vector<long long> > adj;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long n, x, t, m, y, z, k;
  cin >> n;
  adj.resize(n);
  bincoeff(n + 3);
  for (int i = 0; i < n - 1; i++) {
    cin >> x >> y;
    x--, y--;
    adj[x].push_back(y);
    adj[y].push_back(x);
  }
  mint ans = n;
  for (int i = 0; i < n; i++) {
    ans *= fact[adj[i].size()];
  }
  cout << ans.v;
  return 0;
}
