#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <string>
#include <vector>
#include <utility>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <deque>
#include <tuple>
#include <algorithm>
using namespace std;
typedef long double ld;
typedef long long ll;
typedef vector<int> vint;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;
#define rep(i,n)	for(int i=0;i<n;i++)
#define srep(i,a,n)	for(int i=a;i<n;i++)
#define REP(i,n)	for(int i=0;i<=n;i++)
#define SREP(i,a,n)	for(int i=a;i<=n;i++)
#define rrep(i,n)	for(int i=n-1;i>=0;i--)
#define all(a)	(a).begin(),(a).end()
#define mp(a,b)	make_pair(a,b)
#define mt	make_tuple
#define fst	first
#define scn second

const ll inf = (ll)1e18;
const ll mod = (ll)1e9 + 7;
const ld eps = 1e-9;

map<int, ll> dp[210];
vint edge[210];
bool notroot[210];
ll nCm[500][500];

int n;

void dfs(int cur) {
	dp[cur][0] = 1;
	rep(i, edge[cur].size()) {
		int to = edge[cur][i];
		dfs(to);
		map<int, ll> next;
		for (auto a : dp[cur]) {
			for (auto b : dp[to]) {
				//a?????????i?????\??£?????????
				REP(i, min(a.fst, b.fst + 1)) {
					int j = b.fst + 1 - i;//j????????±???????¢???????
					ll select = nCm[a.fst + j][a.fst] * nCm[a.fst][i] % mod;
					next[a.fst + j] += (a.scn*b.scn%mod)*select%mod;
					next[a.fst + j] %= mod;
				}
			}
		}
		dp[cur] = next;
	}
}

int main() {
	nCm[0][0] = 1;
	srep(i, 1, 500)	REP(j, i) {
		if (j)	nCm[i][j] += nCm[i - 1][j - 1];
		nCm[i][j] += nCm[i - 1][j];
		nCm[i][j] %= mod;
	}
	cin >> n;
	srep(i, 1, n) {
		int a, b;	cin >> a >> b;
		edge[a].push_back(b);
		notroot[b] = true;
	}
	rep(i, n) {
		if (!notroot[i]) {
			dfs(i);
			ll ret = 0;
			for (auto it : dp[i]) {
				ret = (ret + it.second) % mod;
			}
			cout << ret << endl;
			return 0;
		}
	}
}