#include <iostream>

using namespace std;
long a[100000];
long u[100000],v[100000];
int main()
{

    long n;
    cin>>n;

    for(long i=1;i<=n;i++){
        cin>>a[i];
    }

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

    return 0;
}