#include <bits/stdc++.h>
//#define int long long
#define pb push_back
#define mp make_pair
#define pii pair<int,int>
#define all(x) (x).begin(),(x).end()
#define fi first
#define sc second
#define endl "\n"

using namespace std;

const int lg = 30;
const int MAXN = 2e5+5;
const long long inf = 1e18;
int vals[MAXN];
vector<vector<int>> graf(MAXN);

signed main()
{
    ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    int tt=1;
    //cin >> tt;
    while(tt--)
    {
        int n;
        cin >> n;
        int mn = inf;
        int index=0;
        for(int i=0; i<n; i++)
        {
            cin >> vals[i+1];
            if(vals[i+1] < mn)
            {
                mn = vals[i+1];
                index = i+1;
            }
        }
        for(int i=0; i<n-1; i++)
        {
            int a,b;cin >> a >> b;
            graf[a].pb(b);
            graf[b].pb(a);
        }
        if(graf[1].size() == n-1)
        {
            cout << mn << endl;
            cout << 1 << endl;
            cout << index << endl;
            cout << 0 << endl;
            cout << 0 << endl;
        }

    }
}