#include using namespace std; const int N = 15; int n, ans, color[N]; struct Node{ int x, y; } a[N]; void dfs(int u){ if(u>5){ bool flag = true; for (int i = 1;i<=n;i++){ if(color[a[i].x]==color[a[i].y]){ flag = false; break; } } if (flag) ans++; return; } for (int i = 1; i <= 4;i++){ color[u]=i; dfs(u + 1); } } int main() { cin>>n; for (int i = 1; i <= n; i++) cin >> a[i].x >> a[i].y; dfs(1); cout<