#include <bits/stdc++.h>
using namespace std;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
inline long long int rand(long long int x, long long int y) {
  ++y;
  return (rng() % (y - x)) + x;
}
string to_string(char c) {
  string second(1, c);
  return second;
}
string to_string(bool b) { return (b ? "true" : "false"); }
template <typename A, typename B>
string to_string(pair<A, B> p) {
  return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}
template <typename A>
string to_string(A v) {
  bool first = true;
  string res = "{";
  for (const auto &x : v) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(x);
  }
  res += "}";
  return res;
}
void degug_out() { cerr << endl; }
template <typename Head, typename... Tail>
void degug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  degug_out(T...);
}
long long int n, fac[(300006)], dp[(300006)];
const long long int MOD = 998244353;
vector<long long int> v[(300006)];
void fact() {
  fac[0] = fac[1] = 1;
  for (long long int i = 2; i <= n; ++i) {
    fac[i] = (i * fac[i - 1]) % MOD;
  }
  return;
}
void dfs(long long int x, long long int p) {
  long long int ans = 1;
  long long int child = 1;
  for (auto i : v[x])
    if (i != p) {
      child++;
      dfs(i, x);
      ans *= dp[i];
      ans %= MOD;
    }
  ans *= fac[child - 1];
  ans %= MOD;
  if (x != 1) ans *= child;
  ans %= MOD;
  return void(dp[x] = ans);
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cin >> n;
  fact();
  for (long long int i = 0; i < (long long int)n - 1; ++i) {
    long long int a, b;
    cin >> a >> b;
    v[a].push_back(b);
    v[b].push_back(a);
  }
  dfs(1, 1);
  cout << (dp[1] * n) % MOD;
}
