#include <bits/stdc++.h>
using namespace std;

#define pb push_back
#define mp make_pair

#define forn(i,n) for(int i = 0;i<int(n);i++)
#define dforn(i,n) for(int i = int(n)-1;i>=0;i--)
#define forsn(i,s,n) for(int i = int(s);i<int(n);i++)
#define fore(i,s,n) for(int i = int(s);i<int(n);i++)
#define dforsn(i,s,n) for(int i = int(n)-1;i>=int(s);i--)

#define DBG(x) do{cout<<#x<<" = "<<x<<endl;}while(false)
#define get(mask,i) (bool(mask&(1<<(i))))
#define set(mask,i) (mask|=(1<<(i)))
#define invert(mask,i) (mask^=(1<<(i)))
#define popcount(mask) (__builtin_popcount(mask))
#define endl '\n'
#define ALL(x) x.begin(),x.end()
template<class T> ostream & operator<<(ostream & out, vector<T> & v){
	out<<"[";
	for(auto k : v) out<<k<<" ";
	out<<"]"<<"\n";
	return out;
}
template<class T> ostream & operator<<(ostream & out, set<T>  s){
	out<<"{";
	for(auto k : s) out<<k<<" ";
	out<<"}"<<"\n";
	return out;
}

template<class T, class U> ostream & operator<<(ostream & out, pair<T,U>  p){
	out<<"[ "<<p.first<<" , "<<p.second<<" ] ";
	return out;
}
template<class T, class U> istream & operator>>(istream & in, pair<T,U> & p){
	in>>p.first>>p.second;
	return in;
}


typedef long long intl;
const int maxn = 5e5;
bitset<maxn> fib;
vector<int> adj[maxn];
vector<int> ids[maxn];
int sum[maxn];
bitset<maxn> idv, vis;
vector<pair<int,int> > ars;
pair<int,int> st[maxn];
int stlar;
int DFS(int nod, int pad){
    if(vis[nod]) return 0;
    vis[nod] = true;
    int cant = 1;
    forn(i,ids[nod].size()){
        int id = ids[nod][i];
        int nex = sum[id]-nod;
        if(nex==pad) continue;
        int val = DFS(nex,nod);
        st[stlar] = {id,val};
        stlar++;
        cant+=val;

    }
    return cant;
}
bool IsFib(int nod){
    if(vis[nod]) return true;
    if(ids[nod].size()==0) return true;
    int kill = -1;
    stlar = 0;
    int p = DFS(nod,-1);
    if(fib[p]==false) return false;
    forn(i,stlar){
        if(fib[st[i].second] && fib[p-st[i].second])
        {
            kill = st[i].first;
            break;
        }
    }
    if(kill==-1) return false;
    idv[kill] = false;
    return true;
}

int main()
{
    cin.tie(0);
    cin.sync_with_stdio(0);
    fib[0] = true;
    fib[1] = true;
    int x = 1, y = 1;
    while(y<maxn){
        fib[x] = fib[y] = true;
        int nx = y, ny = x+y;
        x = nx, y = ny;
    }
    int n;cin>>n;
    forn(i,n-1){
        int a,b;
        cin>>a>>b;
        idv[i] = true;
        sum[i] = a+b;
        ars.push_back({a,b});
    }
    while(true){
        if(idv.count()==0){
            cout<<"YES"<<endl;
            return 0;
        }
        forn(i,n+1) ids[i].resize(0);
        forn(i,n) if(idv[i]){
            ids[ars[i].first].push_back(i);
            ids[ars[i].second].push_back(i);
        }
        vis.reset();
        forsn(i,1,n+1){
            if(IsFib(i)==false){
                cout<<"NO"<<endl;
                return 0;
            }
        }
    }
    return 0;
}
