#include <bits/stdc++.h>
using namespace std;
// debug macros
#ifndef ONLINE_JUDGE
#define printv(v) cerr << #v << ": ";for(auto x : v) cerr << x << ' '; cerr << '\n';
#define deb(...) logger(#__VA_ARGS__, __VA_ARGS__)
template<typename ...Args>
void logger(string vars, Args&&... values) {
cerr << vars << " = ";
string delim = "";
(..., (cerr << delim << values, delim = ", "));
cerr << '\n';
}
#else
#define printv(v) 0
#define deb(...) 0
#endif
// shortcuts
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define endl '\n'
#define pb push_back
#define fr first
#define sc second
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define sz(v) (int)(v).size()
#define TEST int t;cin>>t;while(t--)
typedef long long ll;
typedef string str;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<char> vc;
typedef vector<pii> vii;
typedef vector<vi> vvi;
typedef map<int,int> mii;
typedef set<int> si;
typedef set<char> sc;
void setPrec() { cout << fixed << setprecision(16); }
void setIO(string NAME = "") {
cin.tie(0)->sync_with_stdio(0);
setPrec();
if(sz(NAME)) {
freopen((NAME + ".inp").c_str(),"r",stdin);
freopen((NAME + ".out").c_str(),"w",stdout);
}
}
const int MOD = 998244353;
ll fact[200001];
void initfact(ll n){
fact[0] = 1;
for(ll i = 1 ; i <= n ; i++)
fact[i] = (fact[i-1]*i)%MOD;
}
int main() {
setIO();
ll n; cin >> n;
initfact(n);
vvi edges(n+1);
rep(i,0,n-1){
int a,b; cin >> a >> b;
edges[a].pb(b);
edges[b].pb(a);
}
ll ans = n;
rep(i,1,n+1)
ans=(ans*fact[edges[i].size()])%MOD;
cout << ans << endl;
return 0;
}
519A - A and B and Chess | 725B - Food on the Plane |
154B - Colliders | 127B - Canvas Frames |
107B - Basketball Team | 245A - System Administrator |
698A - Vacations | 1216B - Shooting |
368B - Sereja and Suffixes | 1665C - Tree Infection |
1665D - GCD Guess | 29A - Spit Problem |
1097B - Petr and a Combination Lock | 92A - Chips |
1665B - Array Cloning Technique | 1665A - GCD vs LCM |
118D - Caesar's Legions | 1598A - Computer Game |
1605A - AM Deviation | 1461A - String Generation |
1585B - Array Eversion | 1661C - Water the Trees |
1459A - Red-Blue Shuffle | 1661B - Getting Zero |
1661A - Array Balancing | 1649B - Game of Ball Passing |
572A - Arrays | 1455A - Strange Functions |
1566B - MIN-MEX Cut | 678C - Joty and Chocolate |