#include <bits/stdc++.h>

#define maxn 200002

typedef long long ll;

ll a[maxn];

using namespace std;

int main() {
	int n, u, v;
	cin >> n;
	ll pp = 0, np = 0;
	for(int i = 1; i <= n; i++) {
		cin >> a[i];
		if(i % 2 == 0) np += a[i];
		else pp += a[i];
	} 
	
	for(int i = 0; i < n - 1; i++) cin >> u >> v;
	
    cout << a[0] << "1\n1\n0";
	
	return 0;
}