import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.Arrays; import java.util.Comparator; import java.util.NoSuchElementException; import java.util.PriorityQueue; public class Main { public static void main(String[] args) { new Main().run(); } boolean disjoint(int id, boolean[] on) { boolean ret=true; for(int i=Math.max(0, id-1);i<=Math.min(on.length-1, id+1);++i) { ret&=!on[i]; } return ret; } void run() { FastScanner sc=new FastScanner(); int N=sc.nextInt(); int fst=sc.nextInt()-1; int snd=sc.nextInt()-1; int[] dist=new int[N]; int[] id=new int[N]; int Q=sc.nextInt(); int[] ans=new int[Q]; Arrays.fill(ans, -1); PriorityQueue disjoint=new PriorityQueue<>(); PriorityQueue adjacent=new PriorityQueue<>(); { int p=1; int s=fst,t=fst+1; while (s>0||t0) dist[--s]=p++; } else { if(s>0) dist[--s]=p++; if(t out=new PriorityQueue<>(Comparator.comparing(v->v[0])); for(int i=0;iv[0])); boolean[] on=new boolean[N]; int v=0; int time=0; while(out.size()>1 || v!=Q) { if(out.peek()[0] Integer.MAX_VALUE) throw new NumberFormatException(); return (int) nl; } public double nextDouble() { return Double.parseDouble(next());} }