import java.util.ArrayList;
public class Solution {
public boolean IsPopOrder(int [] pushA,int [] popA) {
for(int i=0;i<popA.length;i++){
if(ofIndex(pushA,popA[i])==-1) return false;
}
int len_both=pushA.length;
//boolean flag=1;
int start=popA[0];
for(int i=1;i<popA.length;i++){
for(int j=i+1;j<popA.length;j++){
if(popA[i]<start && popA[j]<start){
if(ofIndex(pushA,popA[i])<ofIndex(pushA,popA[j])) return false;
}
}
}
return true;
}
public int ofIndex(int [] a,int b){
for(int i=0;i<a.length;i++){
if(a[i]==b){
return i;
}
}
return -1;
}
}