#include <iostream>

using namespace std;

 int main()
{

    unsigned long long int n;
    cin>>n;
    unsigned long long int a[100000];
    for(unsigned long long int i=1;i<=n;i++){
        cin>>a[i];
    }
    unsigned long long int u[100000],v[100000];
    for(unsigned long long int i=1;i<=n-1;i++){
        cin>>u[i]>>v[i];
    }
    cout<<a[1]<<endl;
    cout<<1<<endl<<1<<endl<<0<<endl;
    
    return 0;
}