#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define INF (int)1e8
struct P{
int x,y;
};
struct L{
P l,h;
};
bool operator==(P a,P b){
return a.x==b.x&&a.y==b.y;
}
bool operator<(P a,P b){
return a.x<b.x||a.x==b.x&&a.y<b.y;
}
P operator+(P a,P b){
return P{a.x+b.x,a.y+b.y};
}
P operator-(P a,P b){
return P{a.x-b.x,a.y-b.y};
}
ll dot(P a,P b){
return (ll)a.x*b.x+(ll)a.y*b.y;
}
ll cross(P a,P b){
return (ll)a.x*b.y-(ll)b.x*a.y;
}
ll sq(ll x){
return x*x;
}
int sign(ll x){
return (x>0)-(x<0);
}
int orient(P a,P b,P c){
return sign(cross(a-b,c-b));
}
int right(P a,P b,P c){
return cross(a-b,c-b)>=0;
}
int test(L a,P b){
return cross(a.h-a.l,b-a.l)==0&&dot(a.h-a.l,b-a.l)>dot(a.h-a.l,a.l-a.l)&&dot(a.h-a.l,b-a.l)<dot(a.h-a.l,a.h-a.l);
}
int test(L a,L b){
if(a.l==b.l){
return test(a,b.h)||test(b,a.h);
}
if(a.l==b.h){
return test(a,b.l)||test(b,a.h);
}
if(a.h==b.l){
return test(a,b.h)||test(b,a.l);
}
if(a.h==b.h){
return test(a,b.l)||test(b,a.l);
}
int o1=orient(a.l,a.h,b.l);
int o2=orient(a.l,a.h,b.h);
int o3=orient(b.l,b.h,a.l);
int o4=orient(b.l,b.h,a.h);
return o1!=o2&&o3!=o4;
}
bool operator<(L a,L b){
if(a.l==b.h){
return false;
}
if(a.h==b.l){
return true;
}
int x=!right(b.h,b.l,a.l);
int y=!right(a.h,a.l,b.l);
if(x==y){
x=!right(b.h,b.l,a.h);
y=!right(a.h,a.l,b.h);
}
return x>y;
}
ll length(L a){
return sq(a.h.x-a.l.x)+sq(a.h.y-a.l.y);
}
auto pi = new char[10000000];
auto po = new char[10000000];
auto po0 = po;
int ru() {
int neg=1;
while (!isdigit(*pi)) {
if(*pi=='-')neg=-1;
pi++;
}
int res = 0;
while (isdigit(*pi)) {
res *= 10;
res += *pi - '0';
pi++;
}
return res*neg;
}
void wc(char c) {
*po++ = c;
}
void wu(int i) {
int x = 1;
int c = 1;
while (x <= i / 10) {
x *= 10;
c++;
}
while (c--) {
int d = i / x;
wc('0' + d);
i -= d * x;
i *= 10;
}
}
signed main(){
fread(pi,1,10000000,stdin);
int N=ru();
vector<pair<P,int>>v(N+1);
for(int i=0;i<=N;i++){
v[i].first={ru(),ru()};
v[i].second=i;
}
vector<L>e;
for(int i=1;i<=N;i++){
e.push_back(L{v[0].first,v[i].first});
}
for(int i=0;i<N-1;i++){
int a=ru(),b=ru();
e.push_back(L{v[a].first,v[b].first});
}
for(auto&p:e){
if(p.h<p.l){
swap(p.l,p.h);
}
}
vector<int>ans(N,1);
vector<tuple<P,int,int>>q;
for(int i=0;i<e.size();i++){
q.emplace_back(e[i].l,1,i);
q.emplace_back(e[i].h,2,i);
}
sort(q.begin(),q.end());
set<pair<L,int>>s;
s.emplace(L{P{-INF,-INF},P{INF,-INF}},-1);
s.emplace(L{P{-INF,INF},P{INF,INF}},-1);
for(auto[p,o,i]:q){
if(o==1){
auto it=s.insert(pair<L,int>(e[i],i)).first;
auto lt=prev(it);
auto rt=next(it);
while(test(it->first,lt->first)){
if(it->second<N&&(lt->second>=N||length(it->first)>length(lt->first))){
ans[it->second]=0;
it=s.erase(it);
}
else{
ans[lt->second]=0;
lt=prev(s.erase(lt));
}
}
while(test(it->first,rt->first)){
if(it->second<N&&(rt->second>=N||length(it->first)>length(rt->first))){
ans[it->second]=0;
it=prev(s.erase(it));
}
else{
ans[rt->second]=0;
rt=s.erase(rt);
}
}
}
if(o==2){
auto it=s.find(pair<L,int>(e[i],i));
if(it!=s.end()){
it=s.erase(it);
auto lt=prev(it);
while(test(it->first,lt->first)){
if(it->second<N&&(lt->second>=N||length(it->first)>length(lt->first))){
ans[it->second]=0;
it=s.erase(it);
}
else{
ans[lt->second]=0;
lt=prev(s.erase(lt));
}
}
}
}
}
wu(count(ans.begin(),ans.end(),1));wc('\n');
for(int i=0;i<N;i++){
if(ans[i]){
wu(i+1);wc(' ');
}
}
wc('\n');
fwrite(po0,1,po-po0,stdout);
return 0;
}