Problem:
Score : 1100 points

Problem Statement

There is a tree with N vertices numbered 1, 2, ..., N.
The edges of the tree are denoted by (x_i, y_i).

On this tree, Alice and Bob play a game against each other.
Starting from Alice, they alternately perform the following operation:

Select an existing edge and remove it from the tree, disconnecting it into two separate connected components. Then, remove the component that does not contain Vertex 1.

A player loses the game when he/she is unable to perform the operation.
Determine the winner of the game assuming that both players play optimally.

Constraints

2 \leq N \leq 100000

1 \leq x_i, y_i \leq N

The given graph is a tree.

Input

Input is given from Standard Input in the following format:

N
x_1 y_1
x_2 y_2
:
x_{N-1} y_{N-1}

Output

Print Alice if Alice wins; print Bob if Bob wins.

Sample Input 1

5
1 2
2 3
2 4
4 5

Sample Output 1

Alice

If Alice first removes the edge connecting Vertices 1 and 2, the tree becomes a single vertex tree containing only Vertex 1.
Since there is no edge anymore, Bob cannot perform the operation and Alice wins.

Sample Input 2

5
1 2
2 3
1 4
4 5

Sample Output 2

Bob

Sample Input 3

6
1 2
2 4
5 1
6 3
3 2

Sample Output 3

Alice

Sample Input 4

7
1 2
3 7
4 6
2 3
2 4
1 5

Sample Output 4

Bob

Solution in C++14 (GCC 5.4.1) (judge verdict: Wrong Answer)

#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <fstream>
#include <vector>
#include <string>
#include <set>
#include <list>
#include <map>
#include <queue>
#include <iterator>
#include <iomanip>
#include <stdio.h>
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <utility>
#include <functional>
#include <stack>
#include <deque>
#include <sstream>
using namespace std;

#define ll long long
#define mod 1000000007
#define ld long double
#define infinity (ll)1e18+1
#define PI 3.14159265358979

#define pdd pair<ld,ld>
#define pll pair<ll, ll>
#define pii pair<int,int>

#define MP make_pair
#define SZ size()
#define PB push_back

#define vi vector<int>//ll
#define vll vector<ll>
#define vpll vector<pll>
#define vpii vector<pii>
#define vch vector<char>
#define vb vector<bool>
#define vld vector<ld>

#define FOR(i,a,b) for(ll i = (a); i < (b); ++i)
#define RFOR(i,b,a) for(ll i = (b) - 1; i >= (a); --i)
#define REPEAT(i) FOR(counter1234,0,i)
#define ALL(a) a.begin(), a.end()
#define X first
#define Y second
#define MAXN 100001
clock_t startTime;

int n;
vi g[MAXN];

vi sons;
int c = 0;
vch used;
void dfs(int v)
{
	int s = c;
	used[v] = 1;
	for (auto i : g[v])
		if (used[i] == 0)
			dfs(i), c++;
	sons[v] = c - s;
}
int d[MAXN];

void bfs()
{
	d[1] = 0;
	used.assign(n + 1, 0);
	used[1] = 1;
	queue<int> q;
	q.push(1);
	while (!q.empty())
	{
		int t = q.front();
		q.pop();
		for(auto i: g[t])
			if (used[i] == 0)
			{
				used[i] = 1;
				d[i] = d[t] + 1;
				q.push(i);
			}
	}
}

int main()
{
	srand(time(NULL));
	startTime = clock();
	ios_base::sync_with_stdio(false), cin.tie(0);
	//ifstream in("In.txt");

	cin >> n;
	int a, b;
	sons.assign(n + 1, 0);
	used.assign(n + 1, 0);
	FOR(i, 0, n - 1)
	{
		cin >> a >> b;
		g[a].push_back(b);
		g[b].push_back(a);
	}

	ll XOR_ALL = 0;
	dfs(1);
	bfs();

	vi xors;
	xors.assign(n + 1, 0);

	FOR(i, 1, n + 1)
		for (auto s : g[i])
			if (d[s] > d[i])
				xors[i] ^= (sons[s] + 1);
	

	if (xors[1] == 0)
	{
		cout << "Bob";
		return 0;
	}
	int cou = 0;
	for (auto s : g[1])
		if (xors[s] != 0)
			cou++;

	if (cou % 2 == 1)
		cout << "Alice";
	else
		cout << "Bob";
	return 0;
}
//don't forget about MAXN, mod and infinity