Problem: You are given two multisets A and B. Each multiset has exactly n integers each between 1 and n inclusive. Multisets may contain multiple copies of the same number.

You would like to find a nonempty subset of A and a nonempty subset of B such that the sum of elements in these subsets are equal. Subsets are also multisets, i.e. they can contain elements with equal values.

If no solution exists, print  - 1. Otherwise, print the indices of elements in any such subsets of A and B that have the same sum.

Input

The first line of the input contains a single integer n (1 ≤ n ≤ 1 000 000) — the size of both multisets.

The second line contains n integers, denoting the elements of A. Each element will be between 1 and n inclusive.

The third line contains n integers, denoting the elements of B. Each element will be between 1 and n inclusive.

Output

If there is no solution, print a single integer  - 1. Otherwise, your solution should be printed on four lines.

The first line should contain a single integer ka, the size of the corresponding subset of A. The second line should contain ka distinct integers, the indices of the subset of A.

The third line should contain a single integer kb, the size of the corresponding subset of B. The fourth line should contain kb distinct integers, the indices of the subset of B.

Elements in both sets are numbered from 1 to n. If there are multiple possible solutions, print any of them.

Examples

Input

10
10 10 10 10 10 10 10 10 10 10
10 9 8 7 6 5 4 3 2 1


Output

1
2
3
5 8 10


Input

5
4 4 3 3 3
2 2 2 2 5


Output

2
2 3
2
3 5

Solution (in JAVA):

Solution:
//package codeforcespracice;
import java.io.*;
import java.util.*;
public class doubleknapsack {
	static PrintWriter pw;
	public static void main(String[] args) throws Exception
	{
		InputReader in=new InputReader(System.in);
		pw=new PrintWriter(System.out);
		int n=in.nextInt();
		int[] a=new int[n];
		int[] b=new int[n];
		long asum=0;
		long bsum=0;
		for(int i=0;i<n;i++)
		{
			a[i]=in.nextInt();
			asum+=a[i];
		}
		for(int i=0;i<n;i++)
		{
			b[i]=in.nextInt();
			bsum+=b[i];
		}
	//	Arrays.sort(a);
		//Arrays.sort(b);
		if(asum<bsum)
		{
			solve(n,a,b,false);
		}
		else
		{
			solve(n,b,a,true);
		}
		
		
		pw.close();
	}
	public static void solve(pair[] a,pair[] b,boolean x)
	{
		int n=a.length;
		pair[] arr=new pair[n];
		long sum=0;
		long sum2=0;
		int j=-1;
		for(int i=0;i<n;i++)
		{
			sum+=a[i].a;
			while(j+1<n && (b[j+1].a+sum2)<=sum)
				{
					
					sum2+=b[j+1].a;
					j++;
				}
			int diff=(int)(sum-sum2);
			//System.out.println(diff);
			if(arr[diff]==null)
			{
				arr[diff]=new pair(i,j);
			}
			else if(diff==0)
			{
				if(!x)
				{
					print(a,0,i);
					pw.println();
					print(b,0,j);
				}
				else
				{
					print(b,0,j);
					pw.println();
					print(a,0,i);
					
				}
				return;
			}
			else
			{
				if(!x)
				{
					print(a,arr[diff].a+1,i);
					pw.println();
					print(b,arr[diff].i+1,j);
				}
				else
				{
					print(b,arr[diff].i+1,j);
					pw.println();
					print(a,arr[diff].a+1,i);
					
				}
				return;
				
			}
		}
		
	}
	public static void print(pair[] a,int i,int j)
	{
		pw.println(j-i+1);
		for(int k=i;k<=j;k++)
		{
			pw.print((a[k].i+1)+" ");
		}
		
	}
	static class pair implements Comparable<pair>
	{
		int a,i;
		pair(int a,int i)
		{
			this.a=a;
			this.i=i;
		}
		public int compareTo(pair p1)
		{
			return Integer.compare(this.a, p1.a);
		}
	}

static void printAns(int i, int j) {
	pw.println(j-i);
    for (int k = i+1; k <= j; k++) {
      //  if (k != i+1) printf(" ");
        pw.print( (k+1)+" ");
    }
    pw.println();
}

static void solve(int n, int x[], int y[], boolean swap) {
    long  xs = 0, ys = 0;
    int j = -1;
    pair[] mp=new pair[n];
    mp[0] = new pair(-1, -1);
    for (int i = 0; i < n; i++) {
        xs += x[i];
        while (j+1 < n && ys + y[j+1] <= xs) ys += y[++j];
        int diff = (int)(xs - ys);
        if (mp[diff] !=null) {
            int px = mp[diff].a;
            int py = mp[diff].i;
            if (swap) {
                printAns(py, j);
                printAns(px, i);
            } else {
                printAns(px, i);
                printAns(py, j);
            }
            return;
        }
        mp[diff] = new pair(i, j);
    }
}
	
	
	
	
	
	
	
	
	 static class InputReader {

		private InputStream stream;
		private byte[] buf = new byte[8192];
		private int curChar;
		private int snumChars;
		private SpaceCharFilter filter;

		public InputReader(InputStream stream) {
			this.stream = stream;
		}

		public int snext() {
			if (snumChars == -1)
				throw new InputMismatchException();
			if (curChar >= snumChars) {
				curChar = 0;
				try {
					snumChars = stream.read(buf);
				} catch (IOException e) {
					throw new InputMismatchException();
				}
				if (snumChars <= 0)
					return -1;
			}
			return buf[curChar++];
		}

		public int nextInt() {
			int c = snext();
			while (isSpaceChar(c))
				c = snext();
			int sgn = 1;
			if (c == '-') {
				sgn = -1;
				c = snext();
			}

			int res = 0;

			do {
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res *= 10;
				res += c - '0';
				c = snext();
			} while (!isSpaceChar(c));

			return res * sgn;
		}
		
		public long nextLong() {
			int c = snext();
			while (isSpaceChar(c))
				c = snext();
			int sgn = 1;
			if (c == '-') {
				sgn = -1;
				c = snext();
			}

			long res = 0;

			do {
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res *= 10;
				res += c - '0';
				c = snext();
			} while (!isSpaceChar(c));

			return res * sgn;
		}
		
		public String readString() {
			int c = snext();
			while (isSpaceChar(c))
				c = snext();
			StringBuilder res = new StringBuilder();
			do {
				res.appendCodePoint(c);
				c = snext();
			} while (!isSpaceChar(c));
			return res.toString();
		}

		public boolean isSpaceChar(int c) {
			if (filter != null)
				return filter.isSpaceChar(c);
			return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
		}

		public interface SpaceCharFilter {
			public boolean isSpaceChar(int ch);
		}
	}

}