#include <bits/stdc++.h>

using namespace std;

using ll = long long;
using str = string;
using pi = pair<int,int>;
using pl = pair<ll,ll>;
using vb = vector<bool>;
using vi = vector<int>;
using vl = vector<ll>;
using vpl = vector<pl>;
using vvi = vector<vi>;
using vvl = vector<vl>;
#define f first
#define s second
#define pb push_back
#define bg(x) begin(x)
#define all(x) bg(x), end(x)
#define sor(x) sort(all(x))
#define lb lower_bound
#define sz(x) int((x).size())
#define FOR(i,a,b) for (int i = (a); i < (b); ++i)
#define F0R(i,a) FOR(i,0,a)
#define ROF(i,a,b) for (int i = (b)-1; i >= (a); --i)
#define R0F(i,a) ROF(i,0,a)
#define trav(a,x) for (auto& a: x)

void solve(){
    ll n;
    cin >> n;
    vl v(n + 1);
    F0R(i, n)cin >> v[i + 1];
    vvl l(n + 1);
    F0R(i, n - 1){
        ll u, v;
        cin >> u >> v;
        l[u].pb(v);
        l[v].pb(u);
    }
    if(sz(l[1]) == n - 1){
        ll mn = 1e9 + 5, pos = -1;
        FOR(i, 1, n + 1){
            if(v[i] < mn){
                mn = v[i];
                pos = i;
            }
        }
        cout << mn << "\n";
        cout << 1 << "\n" << pos << "\n";
        cout << 0 << "\n";
        return;
    }

}


int main()
{
    ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    int t; t = 1;while(t--){
        solve();
    }
    return 0;
}