import java.util.*;
import java.lang.*;
import java.io.*;

public class MergeSort {

    public void swap(int [] arr, int i, int j) {
        int tmp = arr[i];
        arr[i] = arr[j];
        arr[j] = tmp;
    }

    public void merge_sort(int []arr, int start, int end,
        int numberOfCalls, int[] count) {

        if((count[0] >= numberOfCalls) || (end - start < 2)) return;
        int mid = (start + end) / 2;
        swap(arr, mid, mid-1);
        count[0] +=2;

        merge_sort(arr, start, mid, numberOfCalls, count);
        merge_sort(arr, mid, end, numberOfCalls, count);
    }

    public void solve(int arr[], int numberOfCalls, int[] count) {
        merge_sort(arr, 0, arr.length-1, numberOfCalls, count);
    }

    public static PrintWriter out;
	public static void main (String[] args) throws java.lang.Exception {
		out = new PrintWriter(new BufferedOutputStream(System.out), true);
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

    		String[] integersInString = br.readLine().split(" ");
    		int N = Integer.parseInt(integersInString[0]);
    		int numberOfCalls = Integer.parseInt(integersInString[1]);

    		int arr[] = new int [N];
    		for(int i=0; i <N; i++) {
    		    arr[i] = i+1;
    		}

    		MergeSort merge = new MergeSort();
    		int count[] = {1};
    		merge.solve(arr, numberOfCalls, count);
    		if (count[0] != numberOfCalls)
    		    out.print(-1);
    		else {
        		for(int i=0; i<arr.length; i++) {
        		    out.print(arr[i] + " ");
        		}
    		}
    		out.println();

		out.close();
	}
}


import java.util.*;
import java.lang.*;
import java.io.*;

public class MergeSort {

    public boolean isSorted(int arr[]) {
        for(int i=1; i<arr.length; i++) {
            if(arr[i-1] > arr[i])
                return false;
        }
        return true;
    }

    public void swap(int [] arr, int i, int j) {
        int tmp = arr[i];
        arr[i] = arr[j];
        arr[j] = tmp;
    }

    public void merge(int [] arr, int start, int mid, int end, int numberOfCalls) {
        int i = start, j = mid + 1;
        int temp[] = new int[end - start + 1];
        int k = 0;

        while(i <= mid && j <= end) {
            if(nums[i] <= nums[j]) {
                temp[k++] = nums[i++];
            } else {
                temp[k++] = nums[j++];
            }
        }

        while(i <= mid) {
            temp[k++] = nums[i++];
        }
        while(j <= end) {
            temp[k++] = nums[j++];
        }

        for(int p = 0; p < end - start + 1; p++) {
            nums[p + start] = temp[p];
        }
    }

    public void merge_sort(int []arr, int start, int end, int numberOfCalls) {

        if(start >= end) return;
        int mid = (start + end) / 2;
        if(mid > 0 && numberOfCalls > 0)
            swap(arr, mid, mid-1);
        numberOfCalls-=2;
        if(numberOfCalls == 0 || isSorted(arr)) {
            return;
        }

        merge_sort(arr, start, mid, numberOfCalls);
        merge_sort(arr, mid+1, end, numberOfCalls);
        merge(arr, start, mid, end, numberOfCalls);
    }

    public void solve(int arr[], int numberOfCalls) {
        merge_sort(arr, 0, arr.length-1, numberOfCalls);
    }

    public static PrintWriter out;
	public static void main (String[] args) throws java.lang.Exception {
		out = new PrintWriter(new BufferedOutputStream(System.out), true);
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

    		String[] integersInString = br.readLine().split(" ");
    		int N = Integer.parseInt(integersInString[0]);
    		int numberOfCalls = Integer.parseInt(integersInString[1]);

    		int arr[] = new int [N];
    		for(int i=0; i <N; i++) {
    		    arr[i] = i+1;
    		}

    		MergeSort merge = new MergeSort();
    		if(numberOfCalls == 1) {
        		for(int i=0; i<arr.length; i++)
        		    out.print(arr[i] + " ");
        		out.println();
    		} else if(numberOfCalls % 2 == 0) {
    		        out.print(-1);
    		} else {
        		merge.solve(arr, numberOfCalls-1);
        		for(int i=0; i<arr.length; i++)
        		    out.print(arr[i] + " ");
        		out.println();
    		}
		out.close();
	}
}


import java.util.*;
import java.lang.*;
import java.io.*;

public class MergeSort {

    public void swap(int [] arr, int i, int j) {
        int tmp = arr[i];
        arr[i] = arr[j];
        arr[j] = tmp;
    }

    public void merge_sort(int []arr, int start, int end,
        int numberOfCalls, int[] count) {

        if(end - start < 2 || count[0] >= numberOfCalls) return;
        int mid = (start + end) / 2;
        swap(arr, mid, mid-1);
        count[0] +=2;

        merge_sort(arr, start, mid, numberOfCalls, count);
        merge_sort(arr, mid+1, end, numberOfCalls, count);
    }

    public void solve(int arr[], int numberOfCalls, int[] count) {
        merge_sort(arr, 0, arr.length-1, numberOfCalls, count);
    }

    public static PrintWriter out;
	public static void main (String[] args) throws java.lang.Exception {
		out = new PrintWriter(new BufferedOutputStream(System.out), true);
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

    		String[] integersInString = br.readLine().split(" ");
    		int N = Integer.parseInt(integersInString[0]);
    		int numberOfCalls = Integer.parseInt(integersInString[1]);

    		int arr[] = new int [N];
    		for(int i=0; i <N; i++) {
    		    arr[i] = i+1;
    		}

    		MergeSort merge = new MergeSort();
    		int[] count = new int[1];
    		count[0] = 1;
    		merge.solve(arr, numberOfCalls, count);
    		if (count != numberOfCalls)
    		    out.print(-1);
    		else {
        		for(int i=0; i<arr.length; i++) {
        		    out.print(arr[i] + " ");
        		}
    		}
    		out.println();

		out.close();
	}
}


import java.util.*;
import java.lang.*;
import java.io.*;

public class MergeSort {

    public void swap(int [] arr, int i, int j) {
        int tmp = arr[i];
        arr[i] = arr[j];
        arr[j] = tmp;
    }

    public void merge_sort(int []arr, int start, int end, int numberOfCalls) {

        if(end - start < 2 || numberOfCalls < 1) return;
        int mid = (start + end) / 2;
        swap(arr, mid, mid-1);
        numberOfCalls-=2;

        merge_sort(arr, start, mid, numberOfCalls);
        merge_sort(arr, mid+1, end, numberOfCalls);
    }

    public void solve(int arr[], int numberOfCalls) {
        merge_sort(arr, 0, arr.length-1, numberOfCalls);
    }

    public static PrintWriter out;
	public static void main (String[] args) throws java.lang.Exception {
		out = new PrintWriter(new BufferedOutputStream(System.out), true);
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

    		String[] integersInString = br.readLine().split(" ");
    		int N = Integer.parseInt(integersInString[0]);
    		int numberOfCalls = Integer.parseInt(integersInString[1]);

    		int arr[] = new int [N];
    		for(int i=0; i <N; i++) {
    		    arr[i] = i+1;
    		}

    		MergeSort merge = new MergeSort();
    		merge.solve(arr, numberOfCalls);
    		if (numberOfCalls != 0) return -1;
    		for(int i=0; i<arr.length; i++) {
    		    out.print(arr[i] + " ");
    		}
    		out.println();

		out.close();
	}
}


import java.util.*;
import java.lang.*;
import java.io.*;

public class MergeSort {

    public void swap(int [] arr, int i, int j) {
        int tmp = arr[i];
        arr[i] = arr[j];
        arr[j] = tmp;
    }

    public void merge_sort(int []arr, int l, int r, int k, int[] count) {

        if((count[0] >= k) || ( l == r - 1 )) return;
        int mid = (l + r) / 2;
        swap(arr, mid-1, mid);
        count[0] +=2;

        merge_sort(arr, l, mid, k, count);
        merge_sort(arr, mid, r, k, count);
    }

    public void solve(int arr[], int N, int k, int[] count) {
        merge_sort(arr, 0, arr.length, k, count);
    }

    public static PrintWriter out;
	public static void main (String[] args) throws java.lang.Exception {
		out = new PrintWriter(new BufferedOutputStream(System.out), true);
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

    		String[] integersInString = br.readLine().split(" ");
    		int N = Integer.parseInt(integersInString[0]);
    		int k = Integer.parseInt(integersInString[1]);

    		int arr[] = new int [N];
    		for(int i=0; i <N; i++) {
    		    arr[i] = i+1;
    		}

    		MergeSort merge = new MergeSort();
    		int count[] = {1};
    		merge.solve(arr, N, k, count);
    		if (count[0] != k)
    		    out.print(-1);
    		else {
        		for(int i=0; i<arr.length; i++) {
        		    out.print(arr[i] + " ");
        		}
    		}
    		out.println();

		out.close();
	}
}


import java.util.*;
import java.lang.*;
import java.io.*;

public class MergeSort {

    public void swap(int [] arr, int i, int j) {
        int tmp = arr[i];
        arr[i] = arr[j];
        arr[j] = tmp;
    }

    public void merge_sort(int []arr, int start, int end,
        int numberOfCalls, Integer count) {

        if(end - start < 2 || count >= numberOfCalls) return;
        int mid = (start + end) / 2;
        swap(arr, mid, mid-1);
        count +=2;

        merge_sort(arr, start, mid, numberOfCalls, count);
        merge_sort(arr, mid+1, end, numberOfCalls, count);
    }

    public void solve(int arr[], int numberOfCalls, Integer count) {
        merge_sort(arr, 0, arr.length-1, numberOfCalls, count);
    }

    public static PrintWriter out;
	public static void main (String[] args) throws java.lang.Exception {
		out = new PrintWriter(new BufferedOutputStream(System.out), true);
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

    		String[] integersInString = br.readLine().split(" ");
    		int N = Integer.parseInt(integersInString[0]);
    		int numberOfCalls = Integer.parseInt(integersInString[1]);

    		int arr[] = new int [N];
    		for(int i=0; i <N; i++) {
    		    arr[i] = i+1;
    		}

    		MergeSort merge = new MergeSort();
    		Integer count = 0;
    		merge.solve(arr, numberOfCalls, count);
    		if (count != numberOfCalls)
    		    out.print(-1);
    		else {
        		for(int i=0; i<arr.length; i++) {
        		    out.print(arr[i] + " ");
        		}
    		}
    		out.println();

		out.close();
	}
}


import java.util.*;
import java.lang.*;
import java.io.*;

public class MergeSort {

    public void swap(int [] arr, int i, int j) {
        int tmp = arr[i];
        arr[i] = arr[j];
        arr[j] = tmp;
    }

    public void merge_sort(int []arr, int l, int r, int k, int[] count) {

        if((count[0] >= k) || ( l == r - 1 )) return;
        int mid = (l + r) / 2;
        swap(arr, mid-1, mid);
        count[0] +=2;

        merge_sort(arr, l, mid, k, count);
        merge_sort(arr, mid, r, k, count);
    }

    public void solve(int arr[], int k, int[] count) {
        merge_sort(arr, 0, arr.length-1, k, count);
    }

    public static PrintWriter out;
	public static void main (String[] args) throws java.lang.Exception {
		out = new PrintWriter(new BufferedOutputStream(System.out), true);
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

    		String[] integersInString = br.readLine().split(" ");
    		int N = Integer.parseInt(integersInString[0]);
    		int k = Integer.parseInt(integersInString[1]);

    		int arr[] = new int [N];
    		for(int i=0; i <N; i++) {
    		    arr[i] = i+1;
    		}

    		MergeSort merge = new MergeSort();
    		int count[] = {1};
    		merge.solve(arr, k, count);
    		if (count[0] != k)
    		    out.print(-1);
    		else {
        		for(int i=0; i<arr.length; i++) {
        		    out.print(arr[i] + " ");
        		}
    		}
    		out.println();

		out.close();
	}
}


import java.util.*;
import java.lang.*;
import java.io.*;

public class MergeSort {
    public void solve(int arr[], int numberOfCalls) {
        merge_sort(arr, 0, arr.length-1, numberOfCalls);
    }

    public boolean isSorted(int arr[]) {
        for(int i=1; i<arr.length; i++) {
            if(arr[i-1] > arr[i])
                return false;
        }
        return true;
    }

    public void swap(int [] arr, int i, int j) {
        int tmp = arr[i];
        arr[i] = arr[j];
        arr[j] = tmp;
    }

    public void merge_sort(int []arr, int start, int end, int numberOfCalls) {

        if(start >= end) return;
        int mid = (start + end) / 2;
        if(mid > 0)
            swap(arr, mid, mid-1);
        if(isSorted(arr) || numberOfCalls==0) return;
        merge_sort(arr, start, mid, numberOfCalls);
        merge_sort(arr, mid+1, end, numberOfCalls);
        merge(arr, start, mid, end, numberOfCalls);
        numberOfCalls--;
    }

    public void merge(int [] arr, int start, int mid, int end, int numberOfCalls) {
        int n1 = mid - start + 1;
        int n2 = end - mid;

        int L[] = new int[n1];
        int R[] = new int[n2];

        for(int i=0; i<n1; i++)
            L[i] = arr[i+start];
        for(int i=0; i<n2; i++)
            R[i] = arr[i+mid+1];

        int i=0, j=0, k=start;
        while(k<=end) {
            if(j>=n2 || i<n1 && L[i] <= R[j])
                arr[k] = L[i++];
            else
                arr[k] = R[j++];
            k++;
        }
    }

    public static PrintWriter out;
	public static void main (String[] args) throws java.lang.Exception {
		out = new PrintWriter(new BufferedOutputStream(System.out), true);
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

    		String[] integersInString = br.readLine().split(" ");
    		int N = Integer.parseInt(integersInString[0]);
    		int numberOfCalls = Integer.parseInt(integersInString[1]);

    		int arr[] = new int [N];
    		for(int i=0; i <N; i++) {
    		    arr[i] = i+1;
    		}

    		MergeSort merge = new MergeSort();
    		merge.solve(arr, numberOfCalls);
		out.close();
	}
}


import java.util.*;
import java.lang.*;
import java.io.*;

public class MergeSort {

    public boolean isSorted(int arr[]) {
        for(int i=1; i<arr.length; i++) {
            if(arr[i-1] > arr[i])
                return false;
        }
        return true;
    }

    public void swap(int [] arr, int i, int j) {
        int tmp = arr[i];
        arr[i] = arr[j];
        arr[j] = tmp;
    }

    public void merge(int [] arr, int start, int mid, int end, int numberOfCalls) {
        int n1 = mid - start + 1;
        int n2 = end - mid;

        int L[] = new int[n1];
        int R[] = new int[n2];

        for(int i=0; i<n1; i++)
            L[i] = arr[i+start];
        for(int i=0; i<n2; i++)
            R[i] = arr[i+mid+1];

        int i=0, j=0, k=start;
        while(k<=end) {
            if(j>=n2 || i<n1 && L[i] <= R[j])
                arr[k] = L[i++];
            else
                arr[k] = R[j++];
            k++;
        }
    }

    public void merge_sort(int []arr, int start, int end, int numberOfCalls) {

        if(start >= end) return;
        int mid = (start + end) / 2;
        if(mid > 0 && numberOfCalls > 0)
            swap(arr, mid, mid-1);
        numberOfCalls-=2;
        if(numberOfCalls == 0 || isSorted(arr)) {
            return;
        }

        merge_sort(arr, start, mid, numberOfCalls);
        merge_sort(arr, mid+1, end, numberOfCalls);
        //merge(arr, start, mid, end, numberOfCalls);
    }

    public void solve(int arr[], int numberOfCalls) {
        merge_sort(arr, 0, arr.length-1, numberOfCalls);
    }

    public static PrintWriter out;
	public static void main (String[] args) throws java.lang.Exception {
		out = new PrintWriter(new BufferedOutputStream(System.out), true);
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

    		String[] integersInString = br.readLine().split(" ");
    		int N = Integer.parseInt(integersInString[0]);
    		int numberOfCalls = Integer.parseInt(integersInString[1]);

    		int arr[] = new int [N];
    		for(int i=0; i <N; i++) {
    		    arr[i] = i+1;
    		}

    		MergeSort merge = new MergeSort();
    		if(numberOfCalls == 1) {
        		for(int i=0; i<arr.length; i++)
        		    out.print(arr[i] + " ");
        		out.println();
    		} else if(numberOfCalls % 2 == 0) {
    		        out.print(-1);
    		} else {
        		merge.solve(arr, numberOfCalls-1);
        		for(int i=0; i<arr.length; i++)
        		    out.print(arr[i] + " ");
        		out.println();
    		}
		out.close();
	}
}


import java.util.*;
import java.lang.*;
import java.io.*;

public class MergeSort {

    public boolean isSorted(int arr[]) {
        for(int i=1; i<arr.length; i++) {
            if(arr[i-1] > arr[i])
                return false;
        }
        return true;
    }

    public void swap(int [] arr, int i, int j) {
        int tmp = arr[i];
        arr[i] = arr[j];
        arr[j] = tmp;
    }

    public void merge(int [] arr, int start, int mid, int end, int numberOfCalls) {
        int n1 = mid - start + 1;
        int n2 = end - mid;

        int L[] = new int[n1];
        int R[] = new int[n2];

        for(int i=0; i<n1; i++)
            L[i] = arr[i+start];
        for(int i=0; i<n2; i++)
            R[i] = arr[i+mid+1];

        int i=0, j=0, k=start;
        while(k<=end) {
            if(j>=n2 || i<n1 && L[i] <= R[j])
                arr[k] = L[i++];
            else
                arr[k] = R[j++];
            k++;
        }
    }

    public void merge_sort(int []arr, int start, int end, int numberOfCalls) {
        numberOfCalls-=2;
        if(start >= end) return;
        int mid = (start + end) / 2;
        if(mid > 0)
            swap(arr, mid, mid-1);
        if(numberOfCalls == 0 || isSorted(arr)) {
            numberOfCallsNotZero = true;
            return;
        }

        merge_sort(arr, start, mid, numberOfCalls);
        merge_sort(arr, mid+1, end, numberOfCalls);
        merge(arr, start, mid, end, numberOfCalls);
    }

    public void solve(int arr[], int numberOfCalls) {
        merge_sort(arr, 0, arr.length-1, numberOfCalls);
    }

    public static boolean numberOfCallsNotZero = false;
    public static PrintWriter out;
	public static void main (String[] args) throws java.lang.Exception {
		out = new PrintWriter(new BufferedOutputStream(System.out), true);
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

    		String[] integersInString = br.readLine().split(" ");
    		int N = Integer.parseInt(integersInString[0]);
    		int numberOfCalls = Integer.parseInt(integersInString[1]);

    		int arr[] = new int [N];
    		for(int i=0; i <N; i++) {
    		    arr[i] = i+1;
    		}

    		MergeSort merge = new MergeSort();
    		merge.solve(arr, numberOfCalls-1);
    		if(numberOfCallsNotZero) {
    		    out.print(-1);
    		} else {
        		for(int i=0; i<arr.length; i++)
        		    out.print(arr[i] + " ");
        		out.println();
    		}
		out.close();
	}
}


import java.io.InputStream;
import java.io.PrintStream;
import java.util.*;

public class Main {

    public static void main(String[] args){
        Main obj = new Main();
        obj.solve(System.in, System.out);

    }

    public void solve(InputStream is, PrintStream ps){
        Scanner input = new Scanner(is);
        int n = input.nextInt();
        int k = input.nextInt();

        if(k%2==0) {
            System.out.println("-1");
            return;
        }

        int temp = n;
        int max = temp;
        while (temp>1) {
            int rest = temp%2;
            temp /= 2;
            max+=temp;
            temp+=rest;
        }
        if(k>max) {
            System.out.println("-1");
            return;
        }

        int[] array = new int[n];

        mergeSortCalls(array,0,n,k);
        for (int i = 0; i < n; i++) {
            if (array[i] == 0) {
                System.out.print(i+1 + " ");
            } else {
                System.out.print(array[i] + " ");
            }
        }
        System.out.println("");
    }

    int mergeSortCalls(int[] array, int start, int end, int k){
        k-=1;
        if (k==0 || k==1) {
            return k;
        }
        if (end-start<=1) {
            array[start]=start+1;
            return k;
        }
        if (end-start==2) {
            array[start]=start+1+1;
            array[start+1]=start+1;
            return k-2;
        }
        if (end-start==3 && (k==2 || k==3)) {
            array[start]=start+2+1;
            array[start+1]=start+1;
            array[start+2]=start+1+1;
            return k-2;
        }
        k--;
        k=mergeSortCalls(array,start,(end+start)/2,k);
        k++;
        k=mergeSortCalls(array, (end + start) / 2, end, k);
        return k;
    }

}


import java.io.InputStream;
import java.io.PrintStream;
import java.util.*;

public class Main {

    public static void main(String[] args){
        Main obj = new Main();
        obj.solve(System.in, System.out);

    }

    public void solve(InputStream is, PrintStream ps){
        Scanner input = new Scanner(is);
        int n = input.nextInt();
        int k = input.nextInt();

        if(k%2==0) {
            System.out.println("-1");
            return;
        }

        int temp = n;
        int max = temp;
        while (temp>1) {
            int rest = temp%2;
            temp /= 2;
            max+=temp;
            temp+=rest;
        }
        if(k>max) {
            System.out.println("-1");
            return;
        }

        int[] array = new int[n];

        mergeSortCalls(array,0,n,k);
        for (int i = 0; i < n; i++) {
            if (array[i] == 0) {
                System.out.print(i+1 + " ");
            } else {
                System.out.print(array[i] + " ");
            }
        }
        System.out.println("");
    }

    int mergeSortCalls(int[] array, int start, int end, int k){
        k-=1;
        if (k==0 || k==1) {
            return k;
        }
        if (end-start<=1) {
            array[start]=start+2;
            return k;
        }
        if (end-start==2) {
            array[start]=start+1+1;
            array[start+1]=start+1;
            return k-2;
        }
        if (end-start==3 && (k==2 || k==3)) {
            array[start]=start+2+1;
            array[start+1]=start+1;
            array[start+2]=start+1+1;
            return k-2;
        }
        k=mergeSortCalls(array,start,(end+start)/2,k);
        if (k>0) {
            k=mergeSortCalls(array, (end + start) / 2, end, k);
        }
        return k;
    }

}


import java.io.InputStream;
import java.io.PrintStream;
import java.util.*;

public class Main {

    public static void main(String[] args){
        Main obj = new Main();
        obj.solve(System.in, System.out);

    }

    public void solve(InputStream is, PrintStream ps){
        Scanner input = new Scanner(is);
        int n = input.nextInt();
        int k = input.nextInt();

        if(k%2==0) {
            System.out.println("-1");
            return;
        }

        int temp = n;
        int max = temp;
        while (temp>1) {
            int rest = temp%2;
            temp /= 2;
            max+=temp;
            temp+=rest;
        }
        if(k>max) {
            System.out.println("-1");
            return;
        }

        int[] array = new int[n];

        mergeSortCalls(array,0,n,k);
        for (int i = 0; i < n; i++) {
            if (array[i] == 0) {
                System.out.print(i+1 + " ");
            } else {
                System.out.print(array[i] + " ");
            }
        }
        System.out.println("");
    }

    int mergeSortCalls(int[] array, int start, int end, int k){
        k-=1;
        if (k==0 || k==1) {
            return k;
        }
        if (end-start<=1) {
            array[start]=start+1;
            return k;
        }
        if (end-start==2) {
            array[start]=start+1+1;
            array[start+1]=start+1;
            return k-2;
        }
        if (end-start==3 && (k==2 || k==3)) {
            array[start]=start+2+1;
            array[start+1]=start+1;
            array[start+2]=start+1+1;
            return k-2;
        }
        k=mergeSortCalls(array,start,(end+start)/2,k);
        if (k>0) {
            k=mergeSortCalls(array, (end + start) / 2, end, k);
        }
        return k;
    }

}


import java.io.InputStream;
import java.io.PrintStream;
import java.util.*;

public class Main {

    public static void main(String[] args){
        Main obj = new Main();
        obj.solve(System.in, System.out);

    }

    public void solve(InputStream is, PrintStream ps){
        Scanner input = new Scanner(is);
        int n = input.nextInt();
        int k = input.nextInt();

        if(k%2==0) {
            System.out.println("-1");
            return;
        }

        int temp = n;
        int max = temp;
        while (temp>1) {
            int rest = temp%2;
            temp /= 2;
            max+=temp;
            temp+=rest;
        }
        if(k>max) {
            System.out.println("-1");
            return;
        }

        int[] array = new int[n];

        mergeSortCalls(array,0,n,k);
        //System.out.println(mergeSortCalls(array,0,n,k));
        for (int i = 0; i < n; i++) {
            if (array[i] == 0) {
                System.out.print(i+1 + " ");
            } else {
                System.out.print(array[i] + " ");
            }
        }
        System.out.println("");
    }

    int mergeSortCalls(int[] array, int start, int end, int k){
        k-=1;
        if (k==0 || k==1) {
            return k;
        }
        if (end-start<=1) {
//            array[start]=start+1;
            return k;
        }
        if (end-start==2) {
            array[start]=start+1+1;
            array[start+1]=start+1;
            return k-2;
        }
        if (k==2) {
            array[(end+start)/2-1]=(end+start)/2+1;
            array[(end+start)/2]=(end+start)/2-1+1;
            return k-2;
        }
        if (end-start==3 && (k==2 || k==3)) {
            array[start]=start+2+1;
            array[start+1]=start+1;
            array[start+2]=start+1+1;
            return k-2;
        }
        k--;
        k=mergeSortCalls(array,start,(end+start)/2,k);
        k++;
        k=mergeSortCalls(array, (end + start) / 2, end, k);
        return k;
    }

}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.StringTokenizer;
/*

 */
public class d {
	static int n,k;
	public static void main(String[] args) throws IOException {
		FastScanner in = new FastScanner(System.in);
		PrintWriter out = new PrintWriter(System.out);
		n = in.nextInt();
		k = in.nextInt();
		if(k % 2 == 0) {
			out.println(-1);
		} else {
			int[] arr = new int[n];
			k--;
			solve(arr, 0, n);
			if(k != 0) {
				out.println(-1);
			} else {
				for(int i=0;i<n;i++) {
					if(i != 0)
						out.print(' ');
					out.print(arr[i]);
				}
				out.println();
			}
		}

		out.close();
	}
	static void solve(int[] arr, int l, int r) {
		if(k == 0 || l+1 == r) {
			int minElement = n-r+1;
			for(int i=l;i<r;i++)
				arr[i] = minElement++;
		} else {
			int mid = (l+r)/2;
			k -= 2;
			solve(arr, l, mid);
			solve(arr, mid, r);
		}
	}
	static class FastScanner {
		BufferedReader br;
		StringTokenizer st;
		public FastScanner(InputStream i) {
			br = new BufferedReader(new InputStreamReader(i));
			st = null;
		}
		public String next() throws IOException {
			while (st == null || !st.hasMoreTokens())
				st = new StringTokenizer(br.readLine());
			return st.nextToken();
		}
		public int nextInt() throws IOException {
			return Integer.parseInt(next());
		}
		public int[] nextIntArray(int n) throws IOException {
			int[] arr = new int[n];
			for (int i = 0; i < n; i++)
				arr[i] = nextInt();
			return arr;
		}
		public long[] nextLongArray(int n) throws IOException {
			long[] arr = new long[n];
			for (int i = 0; i < n; i++)
				arr[i] = nextInt();
			return arr;
		}
		public String[] nextStringArray(int n) throws IOException {
			String[] arr = new String[n];
			for (int i = 0; i < n; i++)
				arr[i] = next();
			return arr;
		}
		public long nextLong() throws IOException {
			return Long.parseLong(next());
		}
		public double nextDouble() throws IOException {
			return Double.parseDouble(next());
		}
	}
}


import java.io.*;
import java.util.*;

public class A {

	static int[] a;

	static int solve(int l, int r, int base, int k)
	{
		if(k == 0)
		{
			for(int i = l; i < r; ++i)
				a[i] = base + i - l;
			return 0;
		}
		if(l + 1 == r)
		{
			a[l] = base;
			return k;
		}
		k = solve(l, (l + r) >> 1, base + r - ((l + r) >> 1), k - 2);
		return solve((l + r) >> 1, r, base, k);
	}

	public static void main(String[] args) throws IOException {

		Scanner sc = new Scanner(System.in);
		PrintWriter out = new PrintWriter(System.out);

		int n = sc.nextInt(), k = sc.nextInt();
		a = new int[n];
		if(k % 2 == 0 || solve(0, n, 1, k - 1) != 0)
			out.println(-1);
		else
		{
			StringBuilder sb = new StringBuilder();
			for(int x: a)
				sb.append(x + " ");
			out.println(sb);
		}
		out.close();
	}

	static class Scanner
	{
		StringTokenizer st;
		BufferedReader br;

		public Scanner(InputStream s){	br = new BufferedReader(new InputStreamReader(s));}

		public Scanner(String s) throws FileNotFoundException {	br = new BufferedReader(new FileReader(s));}

		public String next() throws IOException
		{
			while (st == null || !st.hasMoreTokens())
				st = new StringTokenizer(br.readLine());
			return st.nextToken();
		}

		public int nextInt() throws IOException {return Integer.parseInt(next());}

		public long nextLong() throws IOException {return Long.parseLong(next());}

		public String nextLine() throws IOException {return br.readLine();}

		public double nextDouble() throws IOException { return Double.parseDouble(next()); }

		public boolean ready() throws IOException {return br.ready();}
	}
}


import java.io.*;
import java.math.*;
import java.util.*;
import java.util.stream.*;

@SuppressWarnings("unchecked")
public class P873D {

  class Range {
    int l, r;

    public Range(int l, int r) {
      this.l = l;
      this.r = r;
    }

    Range [] split() {
      return (((r - l) > 1) ? new Range [] { new Range(l, (l + r) >> 1), new Range((l + r) >> 1, r) } : null);
    }

    @Override public String toString() {
      return ("[" + l + ", " + r + ")");
    }
  }

  // --------------------------------------

  public void run() throws Exception {
    int n = nextInt(), k = nextInt();

    if (k >= (n << 1)) {
      println(-1);
      return;
    }

    Deque<Range> rd = new ArrayDeque();
    rd.add(new Range(0, n));

    for (k = k - 1; k > 0;) {
      for (int i = rd.size(); i > 0; i--) {

        Range r = rd.pollFirst(), ra [] = r.split();

        if (ra != null) {
          rd.add(ra[0]);
          rd.add(ra[1]);
          k -= 2;
        } else {
          rd.add(r);
        }
      }
    }

    if (k < 0) {
      println(-1);
      return;
    }

    int a [] = new int [n], v = 1;
    while (rd.size() > 0) {
      for (int i = rd.peekLast().l, j = rd.pollLast().r; i < j; a[i] = v, v++, i++);
    }

    IntStream.of(a).forEach(x -> print(x + " "));
  }

  public static void main(String... args) throws Exception {
    br = new BufferedReader(new InputStreamReader(System.in));
    pw = new PrintWriter(new BufferedOutputStream(System.out));
    new P873D().run();
    br.close();
    pw.close();
    System.err.println("\n[Time : " + (System.currentTimeMillis() - startTime) + " ms]");
  }

  static long startTime = System.currentTimeMillis();
  static BufferedReader br;
  static PrintWriter pw;
  StringTokenizer stok;

  String nextToken() throws IOException {
    while (stok == null || !stok.hasMoreTokens()) {
      String s = br.readLine();
      if (s == null) { return null; }
      stok = new StringTokenizer(s);
    }
    return stok.nextToken();
  }

  void print(byte b) { print("" + b); }
  void print(int i) { print("" + i); }
  void print(long l) { print("" + l); }
  void print(double d) { print("" + d); }
  void print(char c) { print("" + c); }
  void print(Object o) {
    if (o instanceof int[]) { print(Arrays.toString((int [])o));
    } else if (o instanceof long[]) { print(Arrays.toString((long [])o));
    } else if (o instanceof char[]) { print(Arrays.toString((char [])o));
    } else if (o instanceof byte[]) { print(Arrays.toString((byte [])o));
    } else if (o instanceof short[]) { print(Arrays.toString((short [])o));
    } else if (o instanceof boolean[]) { print(Arrays.toString((boolean [])o));
    } else if (o instanceof float[]) { print(Arrays.toString((float [])o));
    } else if (o instanceof double[]) { print(Arrays.toString((double [])o));
    } else if (o instanceof Object[]) { print(Arrays.toString((Object [])o));
    } else { print("" + o); }
  }
  void print(String s) { pw.print(s); }
  void println() { println(""); }
  void println(byte b) { println("" + b); }
  void println(int i) { println("" + i); }
  void println(long l) { println("" + l); }
  void println(double d) { println("" + d); }
  void println(char c) { println("" + c); }
  void println(Object o) { print(o); println(); }
  void println(String s) { pw.println(s); }
  int nextInt() throws IOException { return Integer.parseInt(nextToken()); }
  long nextLong() throws IOException { return Long.parseLong(nextToken()); }
  double nextDouble() throws IOException { return Double.parseDouble(nextToken()); }
  char nextChar() throws IOException { return (char) (br.read()); }
  String next() throws IOException { return nextToken(); }
  String nextLine() throws IOException { return br.readLine(); }
  int [] readInt(int size) throws IOException {
    int [] array = new int [size];
    for (int i = 0; i < size; i++) { array[i] = nextInt(); }
    return array;
  }
  long [] readLong(int size) throws IOException {
    long [] array = new long [size];
    for (int i = 0; i < size; i++) { array[i] = nextLong(); }
    return array;
  }
  double [] readDouble(int size) throws IOException {
    double [] array = new double [size];
    for (int i = 0; i < size; i++) { array[i] = nextDouble(); }
    return array;
  }
  String [] readLines(int size) throws IOException {
    String [] array = new String [size];
    for (int i = 0; i < size; i++) { array[i] = nextLine(); }
    return array;
  }

  int gcd(int a, int b) {
    if (a == 0) return Math.abs(b); if (b == 0) return Math.abs(a);
    a = Math.abs(a); b = Math.abs(b);
    int az = Integer.numberOfTrailingZeros(a), bz = Integer.numberOfTrailingZeros(b);
    a >>>= az; b >>>= bz;
    while (a != b) {
      if (a > b) { a -= b; a >>>= Integer.numberOfTrailingZeros(a); }
            else { b -= a; b >>>= Integer.numberOfTrailingZeros(b); }
    }
    return (a << Math.min(az, bz));
  }

  long gcd(long a, long b) {
    if (a == 0) return Math.abs(b); if (b == 0) return Math.abs(a);
    a = Math.abs(a); b = Math.abs(b);
    int az = Long.numberOfTrailingZeros(a), bz = Long.numberOfTrailingZeros(b);
    a >>>= az; b >>>= bz;
    while (a != b) {
      if (a > b) { a -= b; a >>>= Long.numberOfTrailingZeros(a); }
            else { b -= a; b >>>= Long.numberOfTrailingZeros(b); }
    }
    return (a << Math.min(az, bz));
  }
}


import java.io.*;
import java.math.*;
import java.util.*;
import java.util.stream.*;

@SuppressWarnings("unchecked")
public class P873D {

  class Range implements Comparable<Range> {
    int l, r;

    public Range(int l, int r) {
      this.l = l;
      this.r = r;
    }

    public boolean canSplit() {
      return ((r - l) > 1);
    }

    Range [] split() {
      return new Range [] { new Range(l, (l + r) >> 1), new Range((l + r) >> 1, r) };
    }

    @Override public int compareTo(Range r) {
      return (l - r.l);
    }

    @Override public String toString() {
      return ("[" + l + ", " + r + ")");
    }
  }

  // --------------------------------------

  public void run() throws Exception {
    int n = nextInt(), k = nextInt();

    if (((k & 0b1) == 0) || (k >= (n << 1))) {
      println(-1);
      return;
    }

    Deque<Range> nsd = new ArrayDeque(), sd = new ArrayDeque();
    sd.add(new Range(0, n));

    for (k = k - 1; k > 0; k -= 2) {
      Range [] rs = sd.pollFirst().split();
      (rs[0].canSplit() ? sd : nsd).add(rs[0]);
      (rs[1].canSplit() ? sd : nsd).add(rs[1]);
    }

    List<Range> rl = new ArrayList(nsd);
    rl.addAll(sd);
    sd = nsd = null;

    rl.sort(null);

    int a [] = new int [n], v = 1;
    for (int i = rl.size() - 1; i >= 0; i--) {
      for (int j = rl.get(i).l, l = rl.get(i).r; j < l; a[j] = v, v++, j++);
    }

    IntStream.of(a).forEach(x -> print(x + " "));
  }

  public static void main(String... args) throws Exception {
    br = new BufferedReader(new InputStreamReader(System.in));
    pw = new PrintWriter(new BufferedOutputStream(System.out));
    new P873D().run();
    br.close();
    pw.close();
    System.err.println("\n[Time : " + (System.currentTimeMillis() - startTime) + " ms]");
  }

  static long startTime = System.currentTimeMillis();
  static BufferedReader br;
  static PrintWriter pw;
  StringTokenizer stok;

  String nextToken() throws IOException {
    while (stok == null || !stok.hasMoreTokens()) {
      String s = br.readLine();
      if (s == null) { return null; }
      stok = new StringTokenizer(s);
    }
    return stok.nextToken();
  }

  void print(byte b) { print("" + b); }
  void print(int i) { print("" + i); }
  void print(long l) { print("" + l); }
  void print(double d) { print("" + d); }
  void print(char c) { print("" + c); }
  void print(Object o) {
    if (o instanceof int[]) { print(Arrays.toString((int [])o));
    } else if (o instanceof long[]) { print(Arrays.toString((long [])o));
    } else if (o instanceof char[]) { print(Arrays.toString((char [])o));
    } else if (o instanceof byte[]) { print(Arrays.toString((byte [])o));
    } else if (o instanceof short[]) { print(Arrays.toString((short [])o));
    } else if (o instanceof boolean[]) { print(Arrays.toString((boolean [])o));
    } else if (o instanceof float[]) { print(Arrays.toString((float [])o));
    } else if (o instanceof double[]) { print(Arrays.toString((double [])o));
    } else if (o instanceof Object[]) { print(Arrays.toString((Object [])o));
    } else { print("" + o); }
  }
  void print(String s) { pw.print(s); }
  void println() { println(""); }
  void println(byte b) { println("" + b); }
  void println(int i) { println("" + i); }
  void println(long l) { println("" + l); }
  void println(double d) { println("" + d); }
  void println(char c) { println("" + c); }
  void println(Object o) { print(o); println(); }
  void println(String s) { pw.println(s); }
  int nextInt() throws IOException { return Integer.parseInt(nextToken()); }
  long nextLong() throws IOException { return Long.parseLong(nextToken()); }
  double nextDouble() throws IOException { return Double.parseDouble(nextToken()); }
  char nextChar() throws IOException { return (char) (br.read()); }
  String next() throws IOException { return nextToken(); }
  String nextLine() throws IOException { return br.readLine(); }
  int [] readInt(int size) throws IOException {
    int [] array = new int [size];
    for (int i = 0; i < size; i++) { array[i] = nextInt(); }
    return array;
  }
  long [] readLong(int size) throws IOException {
    long [] array = new long [size];
    for (int i = 0; i < size; i++) { array[i] = nextLong(); }
    return array;
  }
  double [] readDouble(int size) throws IOException {
    double [] array = new double [size];
    for (int i = 0; i < size; i++) { array[i] = nextDouble(); }
    return array;
  }
  String [] readLines(int size) throws IOException {
    String [] array = new String [size];
    for (int i = 0; i < size; i++) { array[i] = nextLine(); }
    return array;
  }

  int gcd(int a, int b) {
    if (a == 0) return Math.abs(b); if (b == 0) return Math.abs(a);
    a = Math.abs(a); b = Math.abs(b);
    int az = Integer.numberOfTrailingZeros(a), bz = Integer.numberOfTrailingZeros(b);
    a >>>= az; b >>>= bz;
    while (a != b) {
      if (a > b) { a -= b; a >>>= Integer.numberOfTrailingZeros(a); }
            else { b -= a; b >>>= Integer.numberOfTrailingZeros(b); }
    }
    return (a << Math.min(az, bz));
  }

  long gcd(long a, long b) {
    if (a == 0) return Math.abs(b); if (b == 0) return Math.abs(a);
    a = Math.abs(a); b = Math.abs(b);
    int az = Long.numberOfTrailingZeros(a), bz = Long.numberOfTrailingZeros(b);
    a >>>= az; b >>>= bz;
    while (a != b) {
      if (a > b) { a -= b; a >>>= Long.numberOfTrailingZeros(a); }
            else { b -= a; b >>>= Long.numberOfTrailingZeros(b); }
    }
    return (a << Math.min(az, bz));
  }
}


import java.io.*;
import java.math.BigInteger;
import java.util.*;

public class Main {

	static InputReader in = new InputReader(System.in);
	static PrintWriter out = new PrintWriter(System.out);

	static int oo = (int)1e9;
//	static long oo = (long)1e15;
//	static int mod = 1_000_000_007;
	static int mod = 998244353;

	static int[] dx = {1, 0, -1, 0};
	static int[] dy = {0, -1, 0, 1};

	static int M = 5001;
	static double EPS = 1e-13;
	static int num = 1;

	public static void main(String[] args) throws IOException {

		int n = in.nextInt();
		int k = in.nextInt();
		int[] a = new int[n];
		boolean p = solve(a, 0, n, k);
		if(!p) {
			System.out.println(-1);
		}
		else {
			for(int x : a)
				System.out.print(x + " ");
		}

		out.close();
	}

	static boolean solve(int[] a, int l, int r, int k) {
		if(k % 2 == 0)
			return false;
		int len = r - l;
		int maxcall = len * 2 - 1;
		if(k > maxcall)
			return false;
		if(k == 1) {
			for(int i = l; i < r; ++i)
				a[i] = num++;
			return true;
		}
		int mid = (l + r) / 2;
		int leftcall = (mid - l) * 2 - 1;
		if(leftcall >= k - 2) {
			solve(a, mid, r, 1);
			solve(a, l, mid, k - 2);
			return true;
		}
		for(int i = mid-1; i >= l; --i) {
			a[i] = num++;
		}
		solve(a, mid, r, k - 1 - leftcall);
		return true;
	}

	static int find(int[] g, int x) {
		return g[x] = g[x] == x ? x : find(g, g[x]);
	}

	static void union(int[] g, int[] size, int x, int y) {
		x = find(g, x); y = find(g, y);
		if(x == y)
			return;
		if(size[x] < size[y]) {
			g[x] = y;
			size[y] += size[x];
		}
		else {
			g[y] = x;
			size[x] += size[y];
		}
	}

	static class Segment {
		Segment left, right;
		int size, minIdx;
//		int time, lazy;

		public Segment(int[] a, int l, int r) {
			super();
			if(l == r) {
				this.minIdx = l;
				this.size = 1;
				return;
			}
			int mid = (l + r) / 2;
			left = new Segment(a, l, mid);
			right = new Segment(a, mid+1, r);
			if(a[left.minIdx] <= a[right.minIdx])
				this.minIdx = left.minIdx;
			else
				this.minIdx = right.minIdx;
			this.size = left.size + right.size;
		}

		boolean covered(int ll, int rr, int l, int r) {
			return ll <= l && rr >= r;
		}

		boolean noIntersection(int ll, int rr, int l, int r) {
			return ll > r || rr < l;
		}

//		void lazyPropagation() {
//			if(lazy != 0) {
//				if(left != null) {
//					left.setLazy(this.time, this.lazy);
//					right.setLazy(this.time, this.lazy);
//				}
//				else {
//					val = lazy;
//				}
//			}
//		}

//		void setLazy(int time, int lazy) {
//			if(this.time != 0 && this.time <= time)
//				return;
//			this.time = time;
//			this.lazy = lazy;
//		}

		int querySize(int ll, int rr, int l, int r) {
//			lazyPropagation();
			if(noIntersection(ll, rr, l, r))
				return 0;
			if(covered(ll, rr, l, r))
				return size;
			int mid = (l + r) / 2;
			int leftSize = left.querySize(ll, rr, l, mid);
			int rightSize = right.querySize(ll, rr, mid+1, r);
			return leftSize + rightSize;
		}

		int query(int k, int l, int r) {
			Segment trace = this;
			while(l < r) {
				int mid = (l + r) / 2;
				if(trace.left.size > k) {
					trace = trace.left;
					r = mid;
				}
				else {
					k -= trace.left.size;
					trace = trace.right;
					l = mid + 1;
				}
			}
			return l;
		}

		void update(int ll, int rr, int l, int r) {
//			lazyPropagation();
			if(noIntersection(ll, rr, l, r))
				return;
			if(covered(ll, rr, l, r)) {
//				setLazy(time, knight);
				this.minIdx = -1;
				this.size = 0;
				return;
			}
			int mid = (l + r) / 2;
			left.update(ll, rr, l, mid);
			right.update(ll, rr, mid+1, r);
			this.size = left.size + right.size;
		}
	}

	static long pow(long a, long n, long mod) {
		if(n == 0)
			return 1;
		if(n % 2 == 1)
			return a * pow(a, n-1, mod) % mod;
		long x = pow(a, n / 2, mod);
		return x * x % mod;
	}

	static int[] getPi(char[] a) {
		int m = a.length;
		int j = 0;
		int[] pi = new int[m];
		for(int i = 1; i < m; ++i) {
			while(j > 0 && a[i] != a[j])
				j = pi[j-1];
			if(a[i] == a[j]) {
				pi[i] = j + 1;
				j++;
			}
		}
		return pi;
	}

	static long lcm(long a, long b) {
		return a * b / gcd(a, b);
	}

	static BigInteger lcm2(long a, long b) {
		long g = gcd(a, b);
		BigInteger gg = BigInteger.valueOf(g);
		BigInteger aa = BigInteger.valueOf(a);
		BigInteger bb = BigInteger.valueOf(b);
		return aa.multiply(bb).divide(gg);
	}

	static boolean nextPermutation(int[] a) {
		for(int i = a.length - 2; i >= 0; --i) {
			if(a[i] < a[i+1]) {
				for(int j = a.length - 1; ; --j) {
					if(a[i] < a[j]) {
						int t = a[i];
						a[i] = a[j];
						a[j] = t;
						for(i++, j = a.length - 1; i < j; ++i, --j) {
							t = a[i];
							a[i] = a[j];
							a[j] = t;
						}
						return true;
					}
				}
			}
		}
		return false;
	}

	static void shuffle(Object[] a) {
		Random r = new Random();
		for(int i = a.length - 1; i > 0; --i) {
			int si = r.nextInt(i);
			Object t = a[si];
			a[si] = a[i];
			a[i] = t;
		}
	}

	static void shuffle(int[] a) {
		Random r = new Random();
		for(int i = a.length - 1; i > 0; --i) {
			int si = r.nextInt(i);
			int t = a[si];
			a[si] = a[i];
			a[i] = t;
		}
	}

	static void shuffle(long[] a) {
		Random r = new Random();
		for(int i = a.length - 1; i > 0; --i) {
			int si = r.nextInt(i);
			long t = a[si];
			a[si] = a[i];
			a[i] = t;
		}
	}

	static int lower_bound(int[] a, int n, int k) {
		int s = 0;
		int e = n;
		int m;
		while (e - s > 0) {
			m = (s + e) / 2;
			if (a[m] < k)
				s = m + 1;
			else
				e = m;
		}
		return e;
	}
	static int lower_bound(long[] a, int n, long k) {
		int s = 0;
		int e = n;
		int m;
		while (e - s > 0) {
			m = (s + e) / 2;
			if (a[m] < k)
				s = m + 1;
			else
				e = m;
		}
		return e;
	}

	static int gcd(int a, int b) {
		return b == 0 ? a : gcd(b, a % b);
	}
	static long gcd(long a, long b) {
		return b == 0 ? a : gcd(b, a % b);
	}
	static BigInteger gcd(BigInteger a, BigInteger b) {
		return b.compareTo(BigInteger.ZERO) == 0 ? a : gcd(b, a.mod(b));
	}

	static class Pair implements Comparable<Pair> {
		int first, second;

		public Pair(int first, int second) {
			super();
			this.first = first;
			this.second = second;
		}

		@Override
		public int compareTo(Pair o) {
			return this.first != o.first ? this.first - o.first : this.second - o.second;
		}

//		@Override
//		public int compareTo(Pair o) {
//			return this.first != o.first ? o.first - this.first : o.second - this.second;
//		}

		@Override
		public int hashCode() {
			final int prime = 31;
			int result = 1;
			result = prime * result + first;
			result = prime * result + second;
			return result;
		}

		@Override
		public boolean equals(Object obj) {
			if (this == obj)
				return true;
			if (obj == null)
				return false;
			if (getClass() != obj.getClass())
				return false;
			Pair other = (Pair) obj;
			if (first != other.first)
				return false;
			if (second != other.second)
				return false;
			return true;
		}
	}
}

class InputReader {

	private final InputStream stream;
	private final byte[] buf = new byte[8192];
	private int curChar, snumChars;

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

	public int read() {
		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 = read();
		while (isSpaceChar(c)) {
			c = read();
		}
		int sgn = 1;
		if (c == '-') {
			sgn = -1;
			c = read();
		}
		int res = 0;
		do {
			res *= 10;
			res += c - '0';
			c = read();
		} while (!isSpaceChar(c));
		return res * sgn;
	}

	public long nextLong() {
		int c = read();
		while (isSpaceChar(c)) {
			c = read();
		}
		int sgn = 1;
		if (c == '-') {
			sgn = -1;
			c = read();
		}
		long res = 0;
		do {
			res *= 10;
			res += c - '0';
			c = read();
		} while (!isSpaceChar(c));
		return res * sgn;
	}

	public int[] nextIntArray(int n) {
		int a[] = new int[n];
		for (int i = 0; i < n; i++) {
			a[i] = nextInt();
		}
		return a;
	}

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

	public String nextLine() {
		int c = read();
		while (isSpaceChar(c))
			c = read();
		StringBuilder res = new StringBuilder();
		do {
			res.appendCodePoint(c);
			c = read();
		} while (!isEndOfLine(c));
		return res.toString();
	}

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

	private boolean isEndOfLine(int c) {
		return c == '\n' || c == '\r' || c == -1;
	}

}


import java.io.*;
import java.math.BigInteger;
import java.util.*;

public class Main {

	static InputReader in = new InputReader(System.in);
	static PrintWriter out = new PrintWriter(System.out);

	static int oo = (int)1e9;
//	static long oo = (long)1e15;
//	static int mod = 1_000_000_007;
	static int mod = 998244353;

	static int[] dx = {1, 0, -1, 0};
	static int[] dy = {0, -1, 0, 1};

	static int M = 5001;
	static double EPS = 1e-13;

	public static void main(String[] args) throws IOException {

		int n = in.nextInt();
		int k = in.nextInt();
		int[] a = new int[n];
		boolean p = solve(a, 0, n, k);
		if(!p) {
			System.out.println(-1);
		}
		else {
			for(int x : a)
				System.out.print(x + " ");
		}

		out.close();
	}

	static boolean solve(int[] a, int l, int r, int k) {
		if(k % 2 == 0)
			return false;
		int len = r - l;
		int maxcall = len * 2 - 1;
		if(k > maxcall)
			return false;
		if(k == 1) {
			for(int i = l; i < r; ++i)
				a[i] = a.length - l + i - l;
			return true;
		}
		int mid = (l + r) / 2;
		int leftcall = (mid - l) * 2 - 1;
		if(leftcall >= k - 2) {
			for(int i = mid; i < r; ++i)
				a[i] = a.length - mid + i - mid;
			solve(a, l, mid, k - 2);
			return true;
		}
		for(int i = l; i < mid; ++i) {
			a[i] = a.length - i;
		}
		solve(a, mid, r, k - 1 - leftcall);
		return true;
	}

	static int find(int[] g, int x) {
		return g[x] = g[x] == x ? x : find(g, g[x]);
	}

	static void union(int[] g, int[] size, int x, int y) {
		x = find(g, x); y = find(g, y);
		if(x == y)
			return;
		if(size[x] < size[y]) {
			g[x] = y;
			size[y] += size[x];
		}
		else {
			g[y] = x;
			size[x] += size[y];
		}
	}

	static class Segment {
		Segment left, right;
		int size, minIdx;
//		int time, lazy;

		public Segment(int[] a, int l, int r) {
			super();
			if(l == r) {
				this.minIdx = l;
				this.size = 1;
				return;
			}
			int mid = (l + r) / 2;
			left = new Segment(a, l, mid);
			right = new Segment(a, mid+1, r);
			if(a[left.minIdx] <= a[right.minIdx])
				this.minIdx = left.minIdx;
			else
				this.minIdx = right.minIdx;
			this.size = left.size + right.size;
		}

		boolean covered(int ll, int rr, int l, int r) {
			return ll <= l && rr >= r;
		}

		boolean noIntersection(int ll, int rr, int l, int r) {
			return ll > r || rr < l;
		}

//		void lazyPropagation() {
//			if(lazy != 0) {
//				if(left != null) {
//					left.setLazy(this.time, this.lazy);
//					right.setLazy(this.time, this.lazy);
//				}
//				else {
//					val = lazy;
//				}
//			}
//		}

//		void setLazy(int time, int lazy) {
//			if(this.time != 0 && this.time <= time)
//				return;
//			this.time = time;
//			this.lazy = lazy;
//		}

		int querySize(int ll, int rr, int l, int r) {
//			lazyPropagation();
			if(noIntersection(ll, rr, l, r))
				return 0;
			if(covered(ll, rr, l, r))
				return size;
			int mid = (l + r) / 2;
			int leftSize = left.querySize(ll, rr, l, mid);
			int rightSize = right.querySize(ll, rr, mid+1, r);
			return leftSize + rightSize;
		}

		int query(int k, int l, int r) {
			Segment trace = this;
			while(l < r) {
				int mid = (l + r) / 2;
				if(trace.left.size > k) {
					trace = trace.left;
					r = mid;
				}
				else {
					k -= trace.left.size;
					trace = trace.right;
					l = mid + 1;
				}
			}
			return l;
		}

		void update(int ll, int rr, int l, int r) {
//			lazyPropagation();
			if(noIntersection(ll, rr, l, r))
				return;
			if(covered(ll, rr, l, r)) {
//				setLazy(time, knight);
				this.minIdx = -1;
				this.size = 0;
				return;
			}
			int mid = (l + r) / 2;
			left.update(ll, rr, l, mid);
			right.update(ll, rr, mid+1, r);
			this.size = left.size + right.size;
		}
	}

	static long pow(long a, long n, long mod) {
		if(n == 0)
			return 1;
		if(n % 2 == 1)
			return a * pow(a, n-1, mod) % mod;
		long x = pow(a, n / 2, mod);
		return x * x % mod;
	}

	static int[] getPi(char[] a) {
		int m = a.length;
		int j = 0;
		int[] pi = new int[m];
		for(int i = 1; i < m; ++i) {
			while(j > 0 && a[i] != a[j])
				j = pi[j-1];
			if(a[i] == a[j]) {
				pi[i] = j + 1;
				j++;
			}
		}
		return pi;
	}

	static long lcm(long a, long b) {
		return a * b / gcd(a, b);
	}

	static BigInteger lcm2(long a, long b) {
		long g = gcd(a, b);
		BigInteger gg = BigInteger.valueOf(g);
		BigInteger aa = BigInteger.valueOf(a);
		BigInteger bb = BigInteger.valueOf(b);
		return aa.multiply(bb).divide(gg);
	}

	static boolean nextPermutation(int[] a) {
		for(int i = a.length - 2; i >= 0; --i) {
			if(a[i] < a[i+1]) {
				for(int j = a.length - 1; ; --j) {
					if(a[i] < a[j]) {
						int t = a[i];
						a[i] = a[j];
						a[j] = t;
						for(i++, j = a.length - 1; i < j; ++i, --j) {
							t = a[i];
							a[i] = a[j];
							a[j] = t;
						}
						return true;
					}
				}
			}
		}
		return false;
	}

	static void shuffle(Object[] a) {
		Random r = new Random();
		for(int i = a.length - 1; i > 0; --i) {
			int si = r.nextInt(i);
			Object t = a[si];
			a[si] = a[i];
			a[i] = t;
		}
	}

	static void shuffle(int[] a) {
		Random r = new Random();
		for(int i = a.length - 1; i > 0; --i) {
			int si = r.nextInt(i);
			int t = a[si];
			a[si] = a[i];
			a[i] = t;
		}
	}

	static void shuffle(long[] a) {
		Random r = new Random();
		for(int i = a.length - 1; i > 0; --i) {
			int si = r.nextInt(i);
			long t = a[si];
			a[si] = a[i];
			a[i] = t;
		}
	}

	static int lower_bound(int[] a, int n, int k) {
		int s = 0;
		int e = n;
		int m;
		while (e - s > 0) {
			m = (s + e) / 2;
			if (a[m] < k)
				s = m + 1;
			else
				e = m;
		}
		return e;
	}
	static int lower_bound(long[] a, int n, long k) {
		int s = 0;
		int e = n;
		int m;
		while (e - s > 0) {
			m = (s + e) / 2;
			if (a[m] < k)
				s = m + 1;
			else
				e = m;
		}
		return e;
	}

	static int gcd(int a, int b) {
		return b == 0 ? a : gcd(b, a % b);
	}
	static long gcd(long a, long b) {
		return b == 0 ? a : gcd(b, a % b);
	}
	static BigInteger gcd(BigInteger a, BigInteger b) {
		return b.compareTo(BigInteger.ZERO) == 0 ? a : gcd(b, a.mod(b));
	}

	static class Pair implements Comparable<Pair> {
		int first, second;

		public Pair(int first, int second) {
			super();
			this.first = first;
			this.second = second;
		}

		@Override
		public int compareTo(Pair o) {
			return this.first != o.first ? this.first - o.first : this.second - o.second;
		}

//		@Override
//		public int compareTo(Pair o) {
//			return this.first != o.first ? o.first - this.first : o.second - this.second;
//		}

		@Override
		public int hashCode() {
			final int prime = 31;
			int result = 1;
			result = prime * result + first;
			result = prime * result + second;
			return result;
		}

		@Override
		public boolean equals(Object obj) {
			if (this == obj)
				return true;
			if (obj == null)
				return false;
			if (getClass() != obj.getClass())
				return false;
			Pair other = (Pair) obj;
			if (first != other.first)
				return false;
			if (second != other.second)
				return false;
			return true;
		}
	}
}

class InputReader {

	private final InputStream stream;
	private final byte[] buf = new byte[8192];
	private int curChar, snumChars;

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

	public int read() {
		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 = read();
		while (isSpaceChar(c)) {
			c = read();
		}
		int sgn = 1;
		if (c == '-') {
			sgn = -1;
			c = read();
		}
		int res = 0;
		do {
			res *= 10;
			res += c - '0';
			c = read();
		} while (!isSpaceChar(c));
		return res * sgn;
	}

	public long nextLong() {
		int c = read();
		while (isSpaceChar(c)) {
			c = read();
		}
		int sgn = 1;
		if (c == '-') {
			sgn = -1;
			c = read();
		}
		long res = 0;
		do {
			res *= 10;
			res += c - '0';
			c = read();
		} while (!isSpaceChar(c));
		return res * sgn;
	}

	public int[] nextIntArray(int n) {
		int a[] = new int[n];
		for (int i = 0; i < n; i++) {
			a[i] = nextInt();
		}
		return a;
	}

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

	public String nextLine() {
		int c = read();
		while (isSpaceChar(c))
			c = read();
		StringBuilder res = new StringBuilder();
		do {
			res.appendCodePoint(c);
			c = read();
		} while (!isEndOfLine(c));
		return res.toString();
	}

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

	private boolean isEndOfLine(int c) {
		return c == '\n' || c == '\r' || c == -1;
	}

}


#include<bits/stdc++.h>
using namespace std;
#define MAXN (int)(2e5 + 5)
#define MAXM (int)(1e2+5)
#define fr first
#define sd second
#define MP make_pair
#define pb push_back
#define SZ(A) (int)A.size()
#define ALL(v) v.begin(), v.end()
#define M0(a) memset(a, 0, sizeof(a))
#define M1(a) memset(a, -1, sizeof(a))
#define REP(i,n) for(int i = 0; i < int(n); i++)
#define REPN(i,n,m) for(int i = m; i <= int(n); i++)
#define RREP(i,n) for(int i = int(n-1); i >= 0; i--)
#define RREPN(i, n, m) for(int i = n; i >= (int)m; i--)
typedef long long ll;
typedef unsigned long long ull;
typedef double db;
typedef long double ld;
const ll INF= ll(1e18 + 5);
const ll MOD = ll(1e9 + 9);
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<pii, pii> ppii;
template<typename T, typename U> inline void AMIN(T &x, U y){ if(x > y) x = y;}
template<typename T, typename U> inline void AMAX(T &x, U y){ if(x < y) x = y;}

void build(map<string, int> &MS, string S) {

        REP(i, S.size()) {

                string X;
                REPN(j, S.size() - 1, i) {

                        X += S[j];
                        MS[X]++;
                }
        }
}

void REM(map<string, int> &MS, string S) {

        REP(i, S.size()) {

                string X;
                REPN(j, S.size() - 1, i) {

                        X += S[j];
                        MS[X]--;
                }
        }
}

string GA(map<string, int> &MS, string S) {

        int len = INT_MAX;
        string ans;
        REP(i, S.size()) {

                string X = "";
                REPN(j, S.size() - 1, i) {

                        X += S[j];
                        if(MS[X] == 1 && X.size() < len)
                                ans = X, len = X.size();
                }
        }
        return ans;
}

int main() {

        //freopen("input.txt", "r", stdin);
        //freopen("output.txt", "w", stdout);
        ios_base::sync_with_stdio(false);
        cin.tie(NULL);
        int N;
        cin >> N;

        vector<string> VS;
        map<string, int> MS;
        REP(i, N) {

                string S;
                cin >> S;
                VS.pb(S);
                build(MS, S);
        }

        REP(i, N) {

                string S = VS[i];
                cout << GA(MS, S) << endl;
        }
        return 0;
}


#define NDEBUG

#include <bits/stdc++.h>
// #include <experimental/string_view>

using namespace std;
// using namespace std::experimental;

#ifdef NDEBUG
#  define debug(...)
#else
#  include "debug.hh"
#endif

int static_init = []() {
  ios_base::sync_with_stdio(false), cin.tie(0), cout << fixed;
  return 0;
}();

constexpr int N = 7e4, L = 9;
int n;
char s[N][L+1];
unordered_map<string_view, vector<int32_t>> c;

string_view run(int i) {
  for (unsigned len = 1; len <= L; len++) {
    for (int j = 0; j+len <= L; j++) {
      string_view sub(&s[i][j], len);
      if (c[sub].size() == 1) return sub;
    }
  }
  abort();
}

int main() {
  cin >> n;
  c.reserve(L*(1+L)/2*n);
  for (int i = 0; i < n; i++) {
    cin >> s[i];
    for (unsigned len = 1; len <= L; len++) {
      for (int j = 0; j+len <= L; j++) {
        auto& v = c[string_view(&s[i][j], len)];
        if (v.empty() || v.back() != i) v.push_back(i);
      }
    }
  }
  for (int i = 0; i < n; i++) cout << run(i) << '\n';
  return 0;
}


#define NDEBUG

#include <bits/stdc++.h>
#include <experimental/string_view>

using namespace std;
using namespace std::experimental;

#ifdef NDEBUG
#  define debug(...)
#else
#  include "debug.hh"
#endif

int static_init = []() {
  ios_base::sync_with_stdio(false), cin.tie(0), cout << fixed;
  return 0;
}();

constexpr int N = 7e4, L = 9;
int n;
char s[N][L+1];
unordered_map<string_view, vector<int32_t>> c;

string_view run(int i) {
  for (unsigned len = 1; len <= L; len++) {
    for (int j = 0; j+len <= L; j++) {
      string_view sub(&s[i][j], len);
      if (c[sub].size() == 1) return sub;
    }
  }
  abort();
}

int main() {
  cin >> n;
  c.reserve(L*(1+L)/2*n);
  for (int i = 0; i < n; i++) {
    cin >> s[i];
    for (unsigned len = 1; len <= L; len++) {
      for (int j = 0; j+len <= L; j++) {
        auto& v = c[string_view(&s[i][j], len)];
        if (v.empty() || v.back() != i) v.push_back(i);
      }
    }
  }
  for (int i = 0; i < n; i++) cout << run(i) << '\n';
  return 0;
}


#define NDEBUG

#include <bits/stdc++.h>

using namespace std;

#ifdef NDEBUG
#  define debug(...)
#else
#  include "debug.hh"
#endif

int static_init = []() {
  ios_base::sync_with_stdio(false), cin.tie(0), cout << fixed;
  return 0;
}();

vector<string> s;
unordered_map<string, vector<int32_t>> c;

string run(const string& ss) {
  for (unsigned len = 1; len <= ss.size(); len++) {
    for (int i = 0; i+len <= ss.size(); i++) {
      auto sub = ss.substr(i, len);
      if (c[sub].size() == 1) return sub;
    }
  }
  abort();
}

int main() {
  int n;
  string ss;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> ss;
    s.push_back(ss);
    for (unsigned len = 1; len <= ss.size(); len++) {
      for (int j = 0; j+len <= ss.size(); j++) {
        auto& v = c[ss.substr(j, len)];
        if (v.empty() || v.back() != i) v.push_back(i);
      }
    }
  }
  for (const string& ss: s) cout << run(ss) << '\n';
  return 0;
}


#define fast ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#include <bits/stdc++.h>
using namespace std;
#define sqr 340
#define mid (l+r)/2
#define pb push_back
#define ppb pop_back
#define fi first
#define se second
#define lb lower_bound
#define ub upper_bound
#define ins insert
#define era erase
#define C continue
#define mem(dp,i) memset(dp,i,sizeof(dp))
#define mset multiset
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pi;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<pi> vpi;
typedef vector<pll> vpll;
const ll mod=1000000007;
const ll mod2=998244353;
const ll mod3=10007;
const ll inf=1e18*4;
const ld pai=acos(-1);
int n;
string a[100009];
unordered_multiset<string>st;
void go(string s,int t){
	for(int i=0;i<s.size();i++){
		string ret="";
		for(int j=i;j<s.size();j++){
			ret+=s[j];
			if(t)st.ins(ret);
			if(!t)st.era(st.find(ret));
		}
	}
}
int main(){
	fast;
	cin>>n;
	for(int i=0;i<n;i++)cin>>a[i],go(a[i],1);
	for(int i=0;i<n;i++){
		string s=a[i];
		int mn=10;
		string ans="";
		go(s,0);
		for(int l=0;l<s.size();l++){
			string ret="";
			for(int r=l;r<s.size();r++){
				ret+=s[r];
				if(st.find(ret)==st.end()){
					if(r-l+1<mn){
						mn=r-l+1;
						ans=ret;
					}
				}
			}
		}
		go(s,1);
		cout<<ans<<endl;
	}
}


#define fast ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#include <bits/stdc++.h>
using namespace std;
#define sqr 340
#define mid (l+r)/2
#define pb push_back
#define ppb pop_back
#define fi first
#define se second
#define lb lower_bound
#define ub upper_bound
#define ins insert
#define era erase
#define C continue
#define mem(dp,i) memset(dp,i,sizeof(dp))
#define mset multiset
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pi;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<pi> vpi;
typedef vector<pll> vpll;
const ll mod=1000000007;
const ll mod2=998244353;
const ll mod3=10007;
const ll inf=1e18*4;
const ld pai=acos(-1);
int n;
string a[100009];
mset<string>st;
void go(string s,int t){
	for(int i=0;i<s.size();i++){
		string ret="";
		for(int j=i;j<s.size();j++){
			ret+=s[j];
			if(t)st.ins(ret);
			if(!t)st.era(st.find(ret));
		}
	}
}
int main(){
	cin>>n;
	for(int i=0;i<n;i++)cin>>a[i],go(a[i],1);
	for(int i=0;i<n;i++){
		string s=a[i];
		int mn=9;
		string ans="";
		go(s,0);
		for(int l=0;l<s.size();l++){
			string ret="";
			for(int r=l;r<s.size();r++){
				ret+=s[r];
				if(st.find(ret)==st.end()){
					if(r-l+1<=mn){
						mn=r-l+1;
						ans=ret;
					}
				}
			}
		}
		go(s,1);
		cout<<ans<<endl;
	}
}


#include<bits/stdc++.h>
#define int long long
#define pb emplace_back
#define mp make_pair
#define tci(v,i) for(auto i=v.begin();i!=v.end();i++)
#define all(v) v.begin(),v.end()
#define rep(i,start,lim) for(long long (i)=(start);i<(lim);i++)
#define revrep(i,n) for(long long i=n-1;i>=0;i--)
#define boost ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define osit ostream_iterator<int> output (cout," ")
#define pv(x) copy(all(x),output)
#define pa(a) rep(i,0,sizeof(a)/sizeof(a[0]))cout<<a[i]<<" "
#define endl '\n'
#define f first
#define s second
#define PI 3.141592653589793
#define set0(x) memset(x,0,sizeof(x))
#define set1(x) memset(x,1,sizeof(x))
#define getarr(arr,n) int arr[n];rep(i,0,n)cin>>a[i]
#define getvec(vec,n) vi vec;int x;rep(i,0,n){cin>>x;vec.pb(x);}
#define sort_uniq(c) (sort(c.begin(), c.end()), c.resize(distance(c.begin(), unique(c.begin(), c.end()))))
#define uniq(a) a.resize(distance(a.begin(), unique(a.begin(), a.end())))
#define dg(x) cout<<#x<<':'<<x<<endl;
#define dg2(x,y) cout<<#x<<':'<<x<<' '<<#y<<':'<<y<<endl;
#define dg3(x,y,z) cout<<#x<<':'<<x<<' '<<#y<<':'<<y<<' '<<#z<<':'<<z<<endl;
#define dg4(x,y,z,zz) cout<<#x<<':'<<x<<' '<<#y<<':'<<y<<' '<<#z<<':'<<z<<' '<<#zz<<':'<<zz<<endl;
using namespace std;
typedef vector<int> vi;
typedef pair<int,int> ii;
typedef vector<ii> vii;
template<typename T> T gcd(T a,T b){if(a==0) return b; return gcd(b%a,a);}
int isPowerof2(int x) { return (x && !(x & x-1)); }

struct classcomp {
    bool operator() (const string& lhs, const string& rhs) const{
        if(lhs.size()!=rhs.size()){
            return lhs.size()<rhs.size();
        }else{
            return lhs<rhs;
        }
    }
};

int32_t main(){
    boost;
    int N;
    cin>>N;
    set<string,classcomp> st[N];
    unordered_map<string,int> mpp;
    rep(i,0,N){
        string s;
        cin>>s;
        int n=s.size();
        for(int len=1;len<=n;len++){
            for(int l=0,r=len-1;r<n;l++,r++){
                string tmp="";
                for(int j=l;j<=r;j++){
                    tmp+=s[j];
                }
                st[i].insert(tmp);
            }
        }
        for(auto el:st[i]){
            mpp[el]++;
        }
    }
    rep(i,0,N){
        //dg(i);
        for(auto el:st[i]){
            //cout<<el<<" ";
            if(mpp[el]==1){
                cout<<el<<endl;
                break;
            }
        }
    }
    return 0;
}


#include<bits/stdc++.h>
#define int long long
#define pb emplace_back
#define mp make_pair
#define tci(v,i) for(auto i=v.begin();i!=v.end();i++)
#define all(v) v.begin(),v.end()
#define rep(i,start,lim) for(long long (i)=(start);i<(lim);i++)
#define revrep(i,n) for(long long i=n-1;i>=0;i--)
#define boost ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define osit ostream_iterator<int> output (cout," ")
#define pv(x) copy(all(x),output)
#define pa(a) rep(i,0,sizeof(a)/sizeof(a[0]))cout<<a[i]<<" "
#define endl '\n'
#define f first
#define s second
#define PI 3.141592653589793
#define set0(x) memset(x,0,sizeof(x))
#define set1(x) memset(x,1,sizeof(x))
#define getarr(arr,n) int arr[n];rep(i,0,n)cin>>a[i]
#define getvec(vec,n) vi vec;int x;rep(i,0,n){cin>>x;vec.pb(x);}
#define sort_uniq(c) (sort(c.begin(), c.end()), c.resize(distance(c.begin(), unique(c.begin(), c.end()))))
#define uniq(a) a.resize(distance(a.begin(), unique(a.begin(), a.end())))
#define dg(x) cout<<#x<<':'<<x<<endl;
#define dg2(x,y) cout<<#x<<':'<<x<<' '<<#y<<':'<<y<<endl;
#define dg3(x,y,z) cout<<#x<<':'<<x<<' '<<#y<<':'<<y<<' '<<#z<<':'<<z<<endl;
#define dg4(x,y,z,zz) cout<<#x<<':'<<x<<' '<<#y<<':'<<y<<' '<<#z<<':'<<z<<' '<<#zz<<':'<<zz<<endl;
using namespace std;
typedef vector<int> vi;
typedef pair<int,int> ii;
typedef vector<ii> vii;
template<typename T> T gcd(T a,T b){if(a==0) return b; return gcd(b%a,a);}
int isPowerof2(int x) { return (x && !(x & x-1)); }

struct classcomp {
    bool operator() (const string& lhs, const string& rhs) const{
        if(lhs.size()!=rhs.size()){
            return lhs.size()<rhs.size();
        }else{
            return lhs<rhs;
        }
    }
};

int32_t main(){
    boost;
    int N;
    cin>>N;
    set<string,classcomp> st[N];
    map<string,int> mpp;
    rep(i,0,N){
        string s;
        cin>>s;
        int n=s.size();
        for(int len=1;len<=n;len++){
            for(int l=0,r=len-1;r<n;l++,r++){
                string tmp="";
                for(int j=l;j<=r;j++){
                    tmp+=s[j];
                }
                st[i].insert(tmp);
            }
        }
        for(auto el:st[i]){
            mpp[el]++;
        }
    }
    rep(i,0,N){
        //dg(i);
        for(auto el:st[i]){
            //cout<<el<<" ";
            if(mpp[el]==1){
                cout<<el<<endl;
                break;
            }
        }
    }
    return 0;
}


#include"bits/stdc++.h"

using namespace std;

#define int long long int

int32_t main(){

        int n;  cin>>n;

        vector<string> s(n);
        for(int i = 0 ; i < n ; i++)   cin >> s[i];

        map<string,int> count;

        for(int i = 0 ; i < n ; i++){

            set<string> occr;

            for(int j = 0 ; j <= 8 ; j++){

                string x = "";

                for(int k = j ; k <= 8 ; k++){

                //	cout <<s[i][k]<<" ";
                    x+=s[i][k];
                   // cout << x <<" ";
                    occr.insert(x);
                }
              //  cout << endl;
            }

            for(auto x:occr) count[x]++;
        }

        for(int i = 0 ;  i < n ; i++){

            string ans = s[i];
            set<string> b;

            for(int j = 0 ; j <= 8 ; j++)
            {
                string x = "";
                for(int k = j ; k <= 8 ; k++){
                    x+=s[i][k];
                   // cout << x <<" ";
                    b.insert(x);
                }
                //cout << endl;
            }
            for(auto x:b){
                if(count[x]==1){
                    if(x.size()<ans.size()){
                        ans = x;
                    }
                }
            }
            cout<<ans<<"\n";
        }

    return 0;
}


#include"bits/stdc++.h"

using namespace std;

#define int long long int

int32_t main(){

        int n;  cin>>n;

        vector<string> s(n);
        for(int i = 0 ; i < n ; i++)   cin >> s[i];

        map<string,int> count;

        for(int i = 0 ; i < n ; i++){

            set<string> occr;

            for(int j = 0 ; j <= 8 ; j++){

                string x = "";

                for(int k = j ; k <= 8 ; k++){

                //	cout <<s[i][k]<<" ";
                    x+=s[i][k];
                   // cout << x <<" ";
                    occr.insert(x);
                }
                cout << endl;
            }

            for(auto x:occr) count[x]++;
        }

        for(int i = 0 ;  i < 1 ; i++){

            string ans = s[i];
            set<string> b;

            for(int j = 0 ; j <= 8 ; j++)
            {
                string x = "";
                for(int k = j ; k <= 8 ; k++){
                    x+=s[i][k];
                   // cout << x <<" ";
                    b.insert(x);
                }
                //cout << endl;
            }
            for(auto x:b){
                if(count[x]==1){
                    if(x.size()<ans.size()){
                        ans = x;
                    }
                }
            }
            cout<<ans<<"\n";
        }

    return 0;
}


#include<bits/stdc++.h>

using namespace std;
#define ff              first
#define ss              second
void c_p_c()
{
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
}

const int N=70005;
map<string,int> mp[N],mpt;
void solve()
{
	int n;
	cin>>n;
	string s[n];
	for(int i=0;i<n;i++)
	{
		cin>>s[i];
	}
	for(int i=0;i<n;i++)
	{
		for(int j=0;j<9;j++)
		{
			string str;
			for(int k=j;k<9;k++)
			{
				str=str+s[i][k];
				mp[i][str]++;
				mpt[str]++;
			}
		}
	}
	for(int i=0;i<n;i++)
	{
		string res=s[i];
		for(auto x:mp[i])
		{
			if(mpt[x.ff]==x.ss)
				if(res.size()>x.ff.size())
					res=x.ff;
		}
		cout<<res<<endl;
	}

}

int32_t main()
{
	c_p_c();
	solve();
	return 0;
}


#include<bits/stdc++.h>

using namespace std;
#define ff              first
#define ss              second
#define int             long long
#define pb              push_back
#define m_p              make_pair
#define pii             pair<int,int>
#define vi              vector<int>
#define mii             map<int,int>
#define pqb             priority_queue<int>
#define pqs             priority_queue<int,vi,greater<int> >
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define mod             1000000007`
#define inf             1e18
#define ps(x,y)         fixed<<setprecision(y)<<x
#define mk(arr,n,type)  type *arr=new type[n];
#define w(x)            int x; cin>>x; while(x--)
mt19937                 rng(chrono::steady_clock::now().time_since_epoch().count());

void c_p_c()
{
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
}

const int N=70005;
map<string,int> mp[N],mpt;
void solve()
{
	int n;
	cin>>n;
	string s[n];
	for(int i=0;i<n;i++)
	{
		cin>>s[i];
	}
	for(int i=0;i<n;i++)
	{
		for(int j=0;j<9;j++)
		{
			string str="";
			for(int k=j;k<9;k++)
			{
				str=str+s[i][k];
				mp[i][str]++;
				mpt[str]++;
			}
		}
	}
	for(int i=0;i<n;i++)
	{
		string res=s[i];
		for(auto x:mp[i])
		{
			if(mpt[x.ff]==x.ss)
				if(res.size()>x.ff.size())
					res=x.ff;
		}
		cout<<res<<endl;
	}

}

int32_t main()
{
	c_p_c();
	solve();
	return 0;
}


#include<bits/stdc++.h>

using namespace std;
#define ff              first
#define ss              second
void c_p_c()
{
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
}

const int N=70005;
map<string,int> mp[N],mpt;
void solve()
{
	int n;
	cin>>n;
	string s[n];
	for(int i=0;i<n;i++)
	{
		cin>>s[i];
	}
	for(int i=0;i<n;i++)
	{
		for(int j=0;j<9;j++)
		{
			string str;
			for(int k=j;k<9;k++)
			{
				str=str+s[i][k];
				mp[i][str]++;
				mpt[str]++;
			}
		}
	}
	for(int i=0;i<n;i++)
	{
		string res=s[i];
		for(auto x:mp[i])
		{
			if(mpt[x.ff]==x.ss){
				if(res.size()>x.ff.size())
					res=x.ff;
			}
		}
		cout<<res<<endl;
	}
	return ;

}

int32_t main()
{
	c_p_c();
	solve();
	return 0;
}


#include<bits/stdc++.h>

using namespace std;
#define ff              first
#define ss              second
void c_p_c()
{
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
}

const int N=70005;
void solve()
{
	int n;
	cin>>n;
	string s[n];
	map<string,int> mp[N],mpt;
	for(int i=0;i<n;i++)
	{
		cin>>s[i];
	}
	for(int i=0;i<n;i++)
	{
		for(int j=0;j<9;j++)
		{
			string str;
			for(int k=j;k<9;k++)
			{
				str=str+s[i][k];
				mp[i][str]++;
				mpt[str]++;
			}
		}
	}
	for(int i=0;i<n;i++)
	{
		string res=s[i];
		for(auto x:mp[i])
		{
			if(mpt[x.ff]==x.ss)
				if(res.size()>x.ff.size())
					res=x.ff;
		}
		cout<<res<<"\n";
	}

}

int32_t main()
{
	c_p_c();
	solve();
	return 0;
}


#include <bits/stdc++.h>
using namespace std;

long long int n, i, j, k;
string s, ss;
unordered_map <string, int> m;
unordered_set <string> st;
unordered_map <string, int>::iterator it;

int main() {
    cin>>n;
    for(i=0; i<n; i++) {
        cin>>s;
        for(j=0; j<9; j++) {
            for(k=1; k<=9-j; k++) {
                ss = s.substr(j, k);
                if(m.empty() || (m.find(ss) == m.end() && st.find(ss) == st.end())) {
                    m.insert({ss, i});
                    continue;
                }
                if(m.find(ss) != m.end() && m.find(ss)->second != i) {
                    st.insert(ss);
                    m.erase(ss);
                }
            }
        }
    }

    vector <string> ans(n, "");
    for(it = m.begin(); it != m.end(); it++) {
        if(ans[it->second] == "" || ans[it->second].length() > it->first.length()) {
            ans[it->second] = it->first;
        }
    }

    for(i=0; i<n; i++) {
        cout<<ans[i]<<endl;
    }
    return 0;
}


#include <bits/stdc++.h>
using namespace std;

struct compare {
    bool operator()(string a, string b) {
        return ((a.length() < b.length()) || (a.length() == b.length() && a < b));
    }
};

long long int n, i, j, k;
string s, ss;
map <string, int, compare> m;
map <string, int>::iterator it;
unordered_set <string> st;

int main() {
	cin>>n;
	vector <string> ans(n, "");
	for(i=0; i<n; i++) {
	    cin>>s;
	    for(j=0; j<9; j++) {
	        for(k=1; k<=9-j; k++) {
	            ss = s.substr(j, k);
	            it = m.find(ss);
	            if(it == m.end() && st.find(ss) == st.end()) {
	                m.insert({ss, i});
	            }
	            else {
	                st.insert(ss);
	                if((*it).second != i) {
	                    m.erase(ss);
	                }
	            }
	        }
	    }
	}

	for(it=m.begin(); it!=m.end(); it++) {
	    if(ans[it->second] == "") {
	        ans[it->second] = it->first;
	    }
	}
	for(i=0; i<n; i++) {
	    cout<<ans[i]<<endl;
	}
	return 0;
}


#include <bits/stdc++.h>

using namespace std;

#define pb push_back
#define ll long long
#define ull unsigned long long
#define all(a)       (a).begin(),(a).end()
#define rep(i,a,n)   for(ll i=a ; i<n ; i++)
#define repn(n)   for(ll i=0 ; i<n ; i++)
#define pii pair<int,int>
#define pll pair<ll,ll>
#define MAXN   1000001
#define f first
#define sec second

ull mod = 1e9+7;
ull ncr( ll n,  ll k)
{
    ull res = 1;

    // Since C(n, k) = C(n, n-k)
    if ( k > n - k )
        k = n - k;

    // Calculate value of
    // [n * (n-1) *---* (n-k+1)] / [k * (k-1) *----* 1]
    for (ll i = 0; i < k; ++i)
    {
        res *= (n - i);
        res /= (i + 1);
        res = res;
    }

    return res;
}
bool prime(ull num)
{
    bool flag=true;
    for(ull i = 2; i*i <= num ; i++)
    {
        if(num % i == 0)
        {
            flag = false;
            break;
        }
    }
    return flag;
}
ll ipow(ll base, ll exp)
{
    ll result = 1;
    for (;;)
    {
        if (exp & 1)
        {
            result *= base;
            result = result%mod;
        }
        exp >>= 1;
        if (!exp)
            break;
        base *= base;
        base = base%mod;
    }

    return result%mod;
}
ll abs(ll a,ll b)
{
    if((a-b)>0)
        return (a-b);
    else
        return (b-a);
}
ll MOD =  998244353;
ll add(ll a, ll b)
{
    a += b;
    if (a >= MOD)
        a -= MOD;
    if (a < 0)
        a += MOD;
    return a;
}
ll gcd(ll a, ll b)
{
    if (b == 0)
        return a;
    return gcd(b, a % b);

}

ll der(ll k)
{
    ll res=0;
    ll fact=1;
    for(ll i=2; i<=k; i++)
        fact *= i;
    ll s=1;
    ll j=1;
    for(ll i=2; i<=k; i++)
    {
        j = j*i;
        ll first = (fact/j)*s;
        res += first;
        s = s*-1;
    }
    return res;
}

////////////////////////////////////////////////////////////////////////////////////////////

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    multiset<string> ms;
    int n;cin>>n;
    string arr[n];
    repn(n){
    set<string> st;
    string s;cin>>s;
    arr[i]=s;
    for(int i=1;i<=9;i++){
        for(int j=0;j<9-i+1;j++)
            st.insert(s.substr(j,i));
    }
    ms.insert(all(st));
    st.clear();
    }
    repn(n){
    string s=arr[i];
      bool ok=false;
      for(int i=1;i<=9;i++){
        for(int j=0;j<9-i+1;j++)
          {
              string tmp = s.substr(j,i);
              if(ms.count(tmp)==1){
                cout<<tmp<<endl;ok=true;break;
              }
          }a
          if(ok)
            break;
    }

    }

}


#include <bits/stdc++.h>

using namespace std;

#define pb push_back
#define ll long long
#define ull unsigned long long
#define all(a)       (a).begin(),(a).end()
#define rep(i,a,n)   for(ll i=a ; i<n ; i++)
#define repn(n)   for(ll i=0 ; i<n ; i++)
#define pii pair<int,int>
#define pll pair<ll,ll>
#define MAXN   1000001
#define f first
#define sec second

ull mod = 1e9+7;
ull ncr( ll n,  ll k)
{
    ull res = 1;

    // Since C(n, k) = C(n, n-k)
    if ( k > n - k )
        k = n - k;

    // Calculate value of
    // [n * (n-1) *---* (n-k+1)] / [k * (k-1) *----* 1]
    for (ll i = 0; i < k; ++i)
    {
        res *= (n - i);
        res /= (i + 1);
        res = res;
    }

    return res;
}
bool prime(ull num)
{
    bool flag=true;
    for(ull i = 2; i*i <= num ; i++)
    {
        if(num % i == 0)
        {
            flag = false;
            break;
        }
    }
    return flag;
}
ll ipow(ll base, ll exp)
{
    ll result = 1;
    for (;;)
    {
        if (exp & 1)
        {
            result *= base;
            result = result%mod;
        }
        exp >>= 1;
        if (!exp)
            break;
        base *= base;
        base = base%mod;
    }

    return result%mod;
}
ll abs(ll a,ll b)
{
    if((a-b)>0)
        return (a-b);
    else
        return (b-a);
}
ll MOD =  998244353;
ll add(ll a, ll b)
{
    a += b;
    if (a >= MOD)
        a -= MOD;
    if (a < 0)
        a += MOD;
    return a;
}
ll gcd(ll a, ll b)
{
    if (b == 0)
        return a;
    return gcd(b, a % b);

}

ll der(ll k)
{
    ll res=0;
    ll fact=1;
    for(ll i=2; i<=k; i++)
        fact *= i;
    ll s=1;
    ll j=1;
    for(ll i=2; i<=k; i++)
    {
        j = j*i;
        ll first = (fact/j)*s;
        res += first;
        s = s*-1;
    }
    return res;
}

////////////////////////////////////////////////////////////////////////////////////////////

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    multiset<string> ms;
    int n;cin>>n;
    string arr[n];
    repn(n){
    set<string> st;
    string s;cin>>s;
    arr[i]=s;
    for(int i=1;i<=9;i++){
        for(int j=0;j<9-i+1;j++)
            st.insert(s.substr(j,i));
    }
    ms.insert(all(st));
    st.clear();
    }
    repn(n){
    string s=arr[i];
      bool ok=false;
      for(int i=1;i<=9;i++){
        for(int j=0;j<9-i+1;j++)
          {
              string tmp = s.substr(j,i);
              if(ms.count(tmp)==1){
                cout<<tmp<<endl;ok=true;break;
              }
          }
          if(ok)
            break;
    }

    }

}


#include<bits/stdc++.h>
#define ll long long
#define fi first
#define se second
#define mp make_pair
#define pb push_back
using namespace std;
string a[70005];
ll n, x;
map < pair < ll , ll > , int > b, c;
int main(){
    cin >>n;
    for (int i = 1; i <= n; ++i){
        cin >>a[i];
        c.clear();
        for (int j = 0; j < a[i].size(); ++j){
            x = 0;
            for (int l = j; l < a[i].size(); ++l){
                x = x * 10 + int(a[i][l] - '0');
                if (!c.count(mp(x, l - j + 1))){
                    c[mp(x, l - j + 1)] = 1;
                    b[mp(x, l - j + 1)]++;
                }
            }
        }
    }
    for (int i = 1; i <= n; ++i){
        ll ans = 1e9;
        for (int j = 0; j < a[i].size(); ++j){
            x = 0;
            for (int l = j; l < a[i].size(); ++l){
                x = x * 10 + int(a[i][l] - '0');
                if (b[mp(x, l - j + 1)] == 1)
                    ans = min(ans, l - j + 1ll);
            }
        }
        bool o = 1;
        for (int j = 0; j < a[i].size() && o; ++j){
            x = 0;
            for (int l = j; l < a[i].size() && o; ++l){
                x = x * 10 + int(a[i][l] - '0');
                if (b[mp(x, l - j + 1)] == 1 && l - j + 1 == ans){
                    o = 0;
                    for (int aa = j; aa <= l; ++aa)
                        cout <<a[i][aa];
                    cout <<endl;
                }
            }
        }
    }
}


#include<bits/stdc++.h>
using namespace std;

#define pi 3.14159265359
#define hell 1000000007
#define io ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define fix(n) cout << fixed << setprecision(n)
#define in1(n,c) c n;cin>>n
#define in2(a,b,c) c a,b;cin>>a>>b
#define ina(a,n,c) c a[n];rep(i,0,n)cin>>a[i]
#define ins(s) string s;cin>>s
#define mset(a,n) memset(a,n,sizeof a)
#define Max(a,b) ((a)>(b)?(a):(b))
#define Min(a,b) ((a)<(b)?(a):(b))
#define rep(i,a,b) for (__typeof((b)) i=(a);i<(b);i++)
#define repp(i,a,b,p) for(__typeof((b)) i=(a);i<(b);i+=p)
#define ren(i,a,b) for(__typeof((a)) i=(a);i>=(b);i--)
#define lbd lower_bound
#define ubd upper_bound
#define ll  long long
#define ull unsigned long long
#define ld long double
#define mp make_pair
#define pb push_back
#define fi first
#define se second
#define vi vector<int>
#define vll vector<ll>
#define pii pair<int,int>
#define pll pair<ll,ll>
#define piii pair<pair<int,int>,int>
#define all(v) (v).begin(), (v).end()
#define sz(x) (int)x.size()
#define out(n) cout<<n<<" "
#define outl(n) cout<<n<<endl
#define line cout<<endl
#define bug(n) {outl(n);return;}
ll n;
string s;
unordered_map<ll,unordered_set<string> > m;
unordered_map<string,unordered_set<ll> > M;
void solve(){
    cin>>n;
    rep(k,1,n+1){
        cin>>s;
        rep(i,0,9){
            string t;
            rep(j,i,9){
                t+=s[j];
                m[k].insert(t);
                M[t].insert(k);
            }
        }
    }
    rep(k,1,n+1){
        string t(10,'0');
        for(auto i:m[k]){
            if(sz(M[i])==1){
                if(sz(i)<sz(t))t=i;
            }
        }
        outl(t);
    }
}
void prep(){

}
int main(){
    io;
    int t=1;
    // cin>>t;
    prep();
    fix(10);
    while(t--)solve();
    return 0;
}


#include<bits/stdc++.h>
using namespace std;

#define pi 3.14159265359
#define hell 1000000007
#define io ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define fix(n) cout << fixed << setprecision(n)
#define in1(n,c) c n;cin>>n
#define in2(a,b,c) c a,b;cin>>a>>b
#define ina(a,n,c) c a[n];rep(i,0,n)cin>>a[i]
#define ins(s) string s;cin>>s
#define mset(a,n) memset(a,n,sizeof a)
#define Max(a,b) ((a)>(b)?(a):(b))
#define Min(a,b) ((a)<(b)?(a):(b))
#define rep(i,a,b) for (__typeof((b)) i=(a);i<(b);i++)
#define repp(i,a,b,p) for(__typeof((b)) i=(a);i<(b);i+=p)
#define ren(i,a,b) for(__typeof((a)) i=(a);i>=(b);i--)
#define lbd lower_bound
#define ubd upper_bound
#define ll  long long
#define ull unsigned long long
#define ld long double
#define mp make_pair
#define pb push_back
#define fi first
#define se second
#define vi vector<int>
#define vll vector<ll>
#define pii pair<int,int>
#define pll pair<ll,ll>
#define piii pair<pair<int,int>,int>
#define all(v) (v).begin(), (v).end()
#define sz(x) (int)x.size()
#define out(n) cout<<n<<" "
#define outl(n) cout<<n<<endl
#define line cout<<endl
#define bug(n) {outl(n);return;}
ll n;
string s[70005];
map<string,ll > m;
void solve(){
    cin>>n;
    rep(k,1,n+1){
        cin>>s[k];
        rep(i,0,9){
            string t;
            rep(j,i,9){
                t+=s[k][j];
                m[t]++;
            }
        }
    }
    rep(k,1,n+1){
        rep(i,0,9){
            string t;
            rep(j,i,9){
                t+=s[k][j];
                m[t]--;
            }
        }
        string t(11,'0');
        rep(i,0,9){
            string S;
            rep(j,i,9){
                S+=s[k][j];
                if(!m[S]&&sz(S)<sz(t))t=S;
            }
        }
        rep(i,0,9){
            string t;
            rep(j,i,9){
                t+=s[k][j];
                m[t]++;
            }
        }
        outl(t);
    }
}
void prep(){

}
int main(){
    io;
    int t=1;
    // cin>>t;
    prep();
    fix(10);
    while(t--)solve();
    return 0;
}


#include<bits/stdc++.h>
using namespace std;

#define pi 3.14159265359
#define hell 1000000007
#define io ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define fix(n) cout << fixed << setprecision(n)
#define in1(n,c) c n;cin>>n
#define in2(a,b,c) c a,b;cin>>a>>b
#define ina(a,n,c) c a[n];rep(i,0,n)cin>>a[i]
#define ins(s) string s;cin>>s
#define mset(a,n) memset(a,n,sizeof a)
#define Max(a,b) ((a)>(b)?(a):(b))
#define Min(a,b) ((a)<(b)?(a):(b))
#define rep(i,a,b) for (__typeof((b)) i=(a);i<(b);i++)
#define repp(i,a,b,p) for(__typeof((b)) i=(a);i<(b);i+=p)
#define ren(i,a,b) for(__typeof((a)) i=(a);i>=(b);i--)
#define lbd lower_bound
#define ubd upper_bound
#define ll  long long
#define ull unsigned long long
#define ld long double
#define mp make_pair
#define pb push_back
#define fi first
#define se second
#define vi vector<int>
#define vll vector<ll>
#define pii pair<int,int>
#define pll pair<ll,ll>
#define piii pair<pair<int,int>,int>
#define all(v) (v).begin(), (v).end()
#define sz(x) (int)x.size()
#define out(n) cout<<n<<" "
#define outl(n) cout<<n<<endl
#define line cout<<endl
#define bug(n) {outl(n);return;}
ll n;
string s[70005];
unordered_map<string,ll > m;
void solve(){
    cin>>n;
    rep(k,1,n+1){
        cin>>s[k];
        rep(i,0,9){
            string t;
            rep(j,i,9){
                t+=s[k][j];
                m[t]++;
            }
        }
    }
    rep(k,1,n+1){
        rep(i,0,9){
            string t;
            rep(j,i,9){
                t+=s[k][j];
                m[t]--;
            }
        }
        string t(11,'0');
        rep(i,0,9){
            string S;
            rep(j,i,9){
                S+=s[k][j];
                if(!m[S]&&sz(S)<sz(t))t=S;
            }
        }
        rep(i,0,9){
            string t;
            rep(j,i,9){
                t+=s[k][j];
                m[t]++;
            }
        }
        outl(t);
    }
}
void prep(){

}
int main(){
    io;
    int t=1;
    // cin>>t;
    prep();
    fix(10);
    while(t--)solve();
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ull unsigned long long
#define mst(a,b) memset((a),(b),sizeof(a))
#define mp(a,b) make_pair(a,b)
#define pi acos(-1)
#define pii pair<int,int>
#define pb push_back
#define lowbit(x) ((x)&(-x))
const int INF = 0x3f3f3f3f;
const double eps = 1e-6;
const int maxn = 7e4 + 10;
const int maxm = 1e6 + 10;
const ll mod =  998244353;

string s[maxn];
unordered_map<string,int>cnt;
unordered_map<string,bool>vis;

int main() {
#ifdef local
    freopen("data.txt", "r", stdin);
//    freopen("data.txt", "w", stdout);
#endif
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int n;
    cin >> n;
    for(int i = 0; i < n; i++) {
        cin >> s[i];
        vis.clear();
        for(int j = 0; j < 9; j++) {
            string s1 = "";
            for(int k = j; k < 9; k++) {
                s1 += s[i][k];
                if(!vis[s1]) vis[s1] = true, cnt[s1]++;
            }
        }
    }
    for(int i = 0; i < n; i++) {
        int ans = 9;
        string out = s[i];
        for(int j = 0; j < 9; j++) {
            string s1 = "";
            for(int k = j; k < 9; k++) {
                if(k - j + 1 >= ans) break;
                s1 += s[i][k];
                if(cnt[s1] == 1 && k - j + 1 < ans) {
                    ans = k - j + 1, out = s1;
//                    cout << i << ':' << j << ' ' << k << endl;
                }
            }
        }
        cout << out << endl;
    }
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ull unsigned long long
#define mst(a,b) memset((a),(b),sizeof(a))
#define mp(a,b) make_pair(a,b)
#define pi acos(-1)
#define pii pair<int,int>
#define pb push_back
#define lowbit(x) ((x)&(-x))
const int INF = 0x3f3f3f3f;
const double eps = 1e-6;
const int maxn = 7e4 + 10;
const int maxm = 1e6 + 10;
const ll mod =  998244353;

string s[maxn];
map<string,int>cnt;
map<string,bool>vis;

int main() {
#ifdef local
    freopen("data.txt", "r", stdin);
//    freopen("data.txt", "w", stdout);
#endif
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int n;
    cin >> n;
    for(int i = 0; i < n; i++) {
        cin >> s[i];
        vis.clear();
        for(int j = 0; j < 9; j++) {
            string s1 = "";
            for(int k = j; k < 9; k++) {
                s1 += s[i][k];
                if(!vis[s1]) vis[s1] = true, cnt[s1]++;
            }
        }
    }
    for(int i = 0; i < n; i++) {
        int ans = 9;
        string out = s[i];
        for(int j = 0; j < 9; j++) {
            string s1 = "";
            for(int k = j; k < 9; k++) {
                if(k - j + 1 >= ans) break;
                s1 += s[i][k];
                if(cnt[s1] == 1 && k - j + 1 < ans) {
                    ans = k - j + 1, out = s1;
//                    cout << i << ':' << j << ' ' << k << endl;
                }
            }
        }
        cout << out << endl;
    }
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ull unsigned long long
#define mst(a,b) memset((a),(b),sizeof(a))
#define mp(a,b) make_pair(a,b)
#define pi acos(-1)
#define pii pair<int,int>
#define pb push_back
#define lowbit(x) ((x)&(-x))
const int INF = 0x3f3f3f3f;
const double eps = 1e-6;
const int maxn = 7e4 + 10;
const int maxm = 1e6 + 10;
const ll mod =  998244353;

string s[maxn];
map<string,int>cnt;
map<string,bool>vis;

int main() {
#ifdef local
    freopen("data.txt", "r", stdin);
//    freopen("data.txt", "w", stdout);
#endif
    int n;
    cin >> n;
    for(int i = 0; i < n; i++) {
        cin >> s[i];
        vis.clear();
        for(int j = 0; j < 9; j++) {
            string s1 = "";
            for(int k = j; k < 9; k++) {
                s1 += s[i][k];
                if(!vis[s1]) vis[s1] = true, cnt[s1]++;
            }
        }
    }
    for(int i = 0; i < n; i++) {
        int ans = 9;
        string out = s[i];
        for(int j = 0; j < 9; j++) {
            string s1 = "";
            for(int k = j; k < 9; k++) {
                s1 += s[i][k];
                if(cnt[s1] == 1 && k - j + 1 < ans) {
                    ans = k - j + 1, out = s1;
//                    cout << i << ':' << j << ' ' << k << endl;
                }
            }
        }
        cout << out << endl;
    }
    return 0;
}


/*input
3
123456789
100000000
100123456
*/
#ifdef UncleGrandpa
#include <prettyprint.hpp>
#endif
#include <bits/stdc++.h>
using namespace std;
#define sp ' '
#define endl '\n'
#define fi first
#define se second
#define bit(x,y) ((x>>y)&1)
#define loop(i,l,r) for(int i=(l); i<=(r); i++)
#define rloop(i,l,r) for(int i=(l); i>=(r); i--)
#define debug(x...) {cout << "[" << #x << "] ="; _print(x);}
void _print() {cout << endl;}
template<typename T, typename... Ts> void _print(const T& value, const Ts&... values) {cout << ' ' << value; _print(values...);}
template<typename T, typename... Ts> void print(const T& value, const Ts&... values) {cout << value; _print(values...);}
// change cout to cerr for debug in crash
// priority to use auto
// const int N =;

int n;
vector<string> a;

map<string, int> mark;
void make(const string &s) {
    loop(i, 0, s.size() - 1) {
        string t;
        loop(j, i, s.size() - 1) {
            t += s[j];
            mark[t]++;
        }
    }
}

string solve(const string &s) {
    loop(len, 1, s.size()) {
        for (int i = 0, j = len - 1; j < s.size(); i++, j++) {
            if (mark[s.substr(i, len)] == 1) {
                return s.substr(i, len);
            }
        }
    }
    assert(false);
}

signed main() {
    ios_base::sync_with_stdio(false); cin.tie(0);
    cin >> n;
    loop(i, 0, n - 1) {
        string s;
        cin >> s; a.push_back(s);
        make(s);
    }
    loop(i, 0, n - 1) {
        cout << solve(a[i]) << endl;
    }
}


/*input
3
123456789
100000000
100123456
*/
#ifdef UncleGrandpa
#include <prettyprint.hpp>
#endif
#include <bits/stdc++.h>
using namespace std;
#define sp ' '
#define endl '\n'
#define fi first
#define se second
#define bit(x,y) ((x>>y)&1)
#define loop(i,l,r) for(int i=(l); i<=(r); i++)
#define rloop(i,l,r) for(int i=(l); i>=(r); i--)
#define debug(x...) {cout << "[" << #x << "] ="; _print(x);}
void _print() {cout << endl;}
template<typename T, typename... Ts> void _print(const T& value, const Ts&... values) {cout << ' ' << value; _print(values...);}
template<typename T, typename... Ts> void print(const T& value, const Ts&... values) {cout << value; _print(values...);}
// change cout to cerr for debug in crash
// priority to use auto
// const int N =;

int n;
vector<string> a;

map<string, int> mark;
map<string, int> mark2;
void make(const string &s) {
    loop(i, 0, s.size() - 1) {
        string t;
        loop(j, i, s.size() - 1) {
            t += s[j];
            mark2[t]++;
        }
    }
    for (auto it : mark2) mark[it.fi]++;
    mark2.clear();
}

string solve(const string &s) {
    loop(len, 1, s.size()) {
        for (int i = 0, j = len - 1; j < s.size(); i++, j++) {
            if (mark[s.substr(i, len)] == 1) {
                return s.substr(i, len);
            }
        }
    }
    assert(false);
}

signed main() {
    ios_base::sync_with_stdio(false); cin.tie(0);
    cin >> n;
    loop(i, 0, n - 1) {
        string s;
        cin >> s; a.push_back(s);
        make(s);
    }
    loop(i, 0, n - 1) {
        cout << solve(a[i]) << endl;
    }
}