#include <bits/stdc++.h>
using namespace std;
const int MOD = 998244353;
const int INTMAX = numeric_limits<int>::max();
const long long LLMAX = numeric_limits<long long>::max();
void writeln() { cout << "\n"; }
template <class T>
inline void print(T&& a);
template <class T>
inline void priws(T&& a);
template <class T>
inline void read(T& a);
template <class... Args>
inline void readln(Args&... args) {
  (read(args), ...);
}
template <class H, class... T>
inline void writeln(H&& h, T&&... t) {
  priws(h);
  (print(t), ...);
  writeln();
}
template <class T>
inline void writeln_range(T f, T s) {
  if (f != s)
    for (auto i = f; i != s; ++i) writeln(*i);
}
vector<string> split(string& s, string d) {
  vector<string> v;
  size_t p = 0;
  while ((p = s.find(d)) != string::npos)
    v.push_back(s.substr(0, p)), s.erase(0, p + d.length());
  v.push_back(s);
  return v;
}
template <class... Args>
inline void err(string v, Args... args) {
  auto vv = split(v, ", ");
  auto it = vv.begin();
  (writeln(*it++, "=", args), ...);
}
template <typename T = int, T mod = 1000000007>
struct modular {
  T value = 0;
  modular() {}
  modular(const modular& other) : value(other.value) {}
  modular operator=(const modular& other) {
    value = other.value;
    return *this;
  }
  template <typename T1>
  modular operator=(const T1& other) {
    if (other > mod)
      value = other % mod;
    else
      value = other;
    return *this;
  }
  template <typename T1>
  modular(T1 const& t) {
    if (t > mod)
      value = t % mod;
    else
      value = t;
  }
  template <typename T1>
  modular(T1 const& num, T1 const& den) {
    value = num * 1ll * binpowmod(den, mod - 2, mod) % mod;
  }
  inline modular& operator+=(modular const& t) {
    value += t.value;
    if (value > mod) value -= mod;
    return *this;
  }
  inline modular& operator-=(modular const& t) {
    value -= t.value;
    if (value < 0) value += mod;
    return *this;
  }
  inline modular& operator*=(modular const& t) {
    value = (value * 1ll * t.value) % mod;
    return *this;
  }
  inline modular operator+(modular const& t) const {
    return modular(*this) += t;
  }
  inline modular operator-(modular const& t) const {
    return modular(*this) -= t;
  }
  inline modular operator*(modular const& t) const {
    return modular(*this) *= t;
  }
  inline friend ostream& operator<<(ostream& os, modular const& m) {
    return os << m.value;
  }
  inline friend istream& operator>>(istream& is, modular& m) {
    return is >> m.value;
  }
};
void run() {
  int n;
  readln(n);
  vector<int> degs(n + 1, 0);
  vector<modular<int, MOD> > fac(2, 1);
  for (int i = 1; i < (int)(n); ++i) fac.push_back(fac.back() * (i + 1));
  for (int i = 0; i < (int)(n - 1); ++i) {
    int u, v;
    readln(u, v);
    degs[u]++;
    degs[v]++;
  }
  modular<int, MOD> ans = 1;
  for (int i = 0; i < (int)(n); ++i) ans *= fac[degs[i + 1]];
  writeln(ans * n);
}
int main() {
  ios_base::sync_with_stdio(false);
  run();
  return 0;
}
template <class T>
inline ostream& operator<<(ostream& os, vector<T> const& _a);
template <class T1, class T2>
inline istream& operator>>(istream& is, pair<T1, T2>& _a) {
  return is >> _a.first >> _a.second;
}
template <class T1, class T2>
inline ostream& operator<<(ostream& os, pair<T1, T2> const& _a) {
  return os << _a.first << " " << _a.second;
}
template <class T>
inline ostream& operator<<(ostream& os, vector<T> const& _a) {
  if (_a.size())
    os << _a[0];
  else
    os << "\n";
  for (int i = 1; i < (int)(_a.size()); ++i)
    os << "\n "[is_fundamental<T>::value] << _a[i];
  return os;
}
template <class T>
inline ostream& operator<<(ostream& os, valarray<T> const& _a) {
  if (_a.size())
    os << _a[0];
  else
    os << "\n";
  for (int i = 1; i < (int)(_a.size()); ++i)
    os << "\n "[is_fundamental<T>::value] << _a[i];
  return os;
}
template <class T>
inline istream& operator>>(istream& is, vector<T>& _a) {
  for (int i = 0; i < (int)(_a.size()); ++i) is >> _a[i];
  return is;
}
template <class T>
inline istream& operator>>(istream& is, valarray<T>& _a) {
  for (int i = 0; i < (int)(_a.size()); ++i) is >> _a[i];
  return is;
}
template <class T>
inline void print(T&& _a) {
  cout << " " << _a;
}
template <class T>
inline void priws(T&& _a) {
  cout << _a;
}
template <class T>
inline void read(T& _a) {
  cin >> _a;
}
