#include<bits/stdc++.h>
using namespace std;
#define ll long long
ll power(ll x){
    if(x==1){
        return 2;
    }
    if(x==0)
    return 1;
    ll tmp;
    if(x%2==0)
    {
        tmp=power(x/2);
        return (tmp*tmp);
    }
    tmp=power((x-1)/2);
    tmp=(tmp*tmp);
    tmp=tmp*2;
    return tmp;
}
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    long n;
    cin>>n;
    ll a[n+1],b[n+1];
    ll arr[n+1][2];
    memset(arr,0,sizeof(arr));
    long k,i;
    for(i=1;i<=n;++i){
        cin>>a[i]>>b[i];
    }
    for(k=1;2*k<=n;++k){
        arr[k][0]=1;
        arr[k][1]=1;
        long l=k+1,r=k+1,cnt=2*k;
        while(cnt<n){
            if(a[l]<b[r]){
                arr[l][0]=1;
                l++;
                cnt++;

            }
            else{
                arr[r][1]=1;
                r++;
                cnt++;
            }
        }
    }
    if(n==1){
        if(a[0]<b[0]){
            arr[1][0]=1;
        }else
        arr[1][1]=1;
    }
    for(i=1;i<=n;++i){
        cout<<arr[i][0];
    }
    cout<<"\n";
    for(i=1;i<=n;++i){
        cout<<arr[i][1];
    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long
ll power(ll x){
    if(x==1){
        return 2;
    }
    if(x==0)
    return 1;
    ll tmp;
    if(x%2==0)
    {
        tmp=power(x/2);
        return (tmp*tmp);
    }
    tmp=power((x-1)/2);
    tmp=(tmp*tmp);
    tmp=tmp*2;
    return tmp;
}
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    long n;
    cin>>n;
    ll a[n+1],b[n+1];
    ll arr[n+1][2];
    memset(arr,0,sizeof(arr));
    long k,i;
    for(i=1;i<=n;++i){
        cin>>a[i]>>b[i];
    }
    for(k=1;2*k<=n;++k){
        arr[k][0]=1;
        arr[k][1]=1;
        long l=k+1,r=k+1,cnt=2*k;
        while(cnt<n){
            if(a[l]<b[r]){
                arr[l][0]=1;
                l++;
                cnt++;

            }
            else{
                arr[r][1]=1;
                r++;
                cnt++;
            }
        }
    }
    for(i=1;i<=n;++i){
        cout<<arr[i][0];
    }
    cout<<"\n";
    for(i=1;i<=n;++i){
        cout<<arr[i][1];
    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long
ll power(ll x){
    if(x==1){
        return 2;
    }
    if(x==0)
    return 1;
    ll tmp;
    if(x%2==0)
    {
        tmp=power(x/2);
        return (tmp*tmp);
    }
    tmp=power((x-1)/2);
    tmp=(tmp*tmp);
    tmp=tmp*2;
    return tmp;
}
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    long n;
    cin>>n;
    ll a[n+1],b[n+1];
    ll arr[n+1][2];
    memset(arr,0,sizeof(arr));
    long k,i;
    for(i=1;i<=n;++i){
        cin>>a[i]>>b[i];
    }
    for(k=0;2*k<=n;++k){
        arr[k][0]=1;
        arr[k][1]=1;
        long l=k+1,r=k+1,cnt=2*k;
        while(cnt<n){
            if(a[l]<b[r]){
                arr[l][0]=1;
                l++;
                cnt++;

            }
            else{
                arr[r][1]=1;
                r++;
                cnt++;
            }
        }
    }

    for(i=1;i<=n;++i){
        cout<<arr[i][0];
    }
    cout<<"\n";
    for(i=1;i<=n;++i){
        cout<<arr[i][1];
    }
    return 0;
}


//package codeforces;

import java.io.PrintWriter;
import java.util.Scanner;

/**
 *
 * @author huseyngasimov
 */
public class Semifinals {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        PrintWriter out = new PrintWriter(System.out);
        int n = in.nextInt();
        int[] first_semi = new int[n];
        int[] second_semi = new int[n];

        for (int i = 0; i < n; i++) {
            first_semi[i] = in.nextInt();
            second_semi[i] = in.nextInt();
        }

        int i = 0, j = 0;
        for (int total = 0; total < n; total++) {
            if (first_semi[i] < second_semi[j]) i++;
            else j++;
        }

        int k = n/2;
        i = Math.max(i, k);
        j = Math.max(j, k);

        printArray(i, n, out);
        printArray(j, n, out);

        out.flush();
    }

    private static void printArray(int k, int n, PrintWriter out) {
        int i = 0;
        for (; i < k; i++) out.print(1);
        for (; i < n; i++) out.print(0);
        out.println();
    }
}


//package codeforces;

import java.io.PrintWriter;
import java.util.Scanner;

/**
 *
 * @author huseyngasimov
 */
public class Semifinals {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        PrintWriter out = new PrintWriter(System.out);
        int n = in.nextInt();
        int[] first_semi = new int[n];
        int[] second_semi = new int[n];
        int first_hasChance = -1;
        int second_hasChance = -1;

        for (int i = 0; i < n; i++) {
            first_semi[i] = in.nextInt();
            second_semi[i] = in.nextInt();
        }

        for (int k = 0; k <= n/2; k++) {

            first_hasChance = Math.max(first_hasChance, k-1);
            second_hasChance = Math.max(second_hasChance, k-1);

            int i = k, j = k;

            for (int total = 2*k; total < n; total++) {
                if (first_semi[i] < second_semi[j])
                    first_hasChance = Math.max(first_hasChance, i++);
                else
                    second_hasChance = Math.max(second_hasChance, j++);
            }

            int solvedK = Math.min(i-1, j-1);
            k = Math.max(k, solvedK);
        }

        printArray(first_hasChance, n, out);
        printArray(second_hasChance, n, out);

        out.flush();
    }

    private static void printArray(int k, int n, PrintWriter out) {
        int i = 0;
        for (; i <= k; i++) out.print(1);
        for (; i < n; i++) out.print(0);
        out.println();
    }
}


//package codeforces;

import java.io.PrintWriter;
import java.util.Scanner;

/**
 *
 * @author huseyngasimov
 */
public class Semifinals {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        PrintWriter out = new PrintWriter(System.out);
        int n = in.nextInt();
        int[] first_semi = new int[n];
        int[] second_semi = new int[n];
        int[] first_hasChance = new int[n];
        int[] second_hasChance = new int[n];

        for (int i = 0; i < n; i++) {
            first_semi[i] = in.nextInt();
            second_semi[i] = in.nextInt();
        }

        for (int k = 0; k <= n/2; k++) {
            int i = 0, j = 0;

            for (; i < k; i++, j++) {
                first_hasChance[i] = 1;
                second_hasChance[j] = 1;
            }

            for (int total = 2*k; total < n; total++) {
                if (first_semi[i] < second_semi[j])
                    first_hasChance[i++] = 1;
                else
                    second_hasChance[j++] = 1;
            }
        }

        printArray(first_hasChance, out);
        printArray(second_hasChance, out);

        out.flush();
    }

    private static void printArray(int[] a, PrintWriter out) {
        for (int i: a) out.print(i);
        out.println();
    }
}


//package codeforces;

import java.io.PrintWriter;
import java.util.Scanner;

/**
 *
 * @author huseyngasimov
 */
public class Semifinals {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        PrintWriter out = new PrintWriter(System.out);
        int n = in.nextInt();
        int[] first_semi = new int[n];
        int[] second_semi = new int[n];
        int first_hasChance = -1;
        int second_hasChance = -1;

        for (int i = 0; i < n; i++) {
            first_semi[i] = in.nextInt();
            second_semi[i] = in.nextInt();
        }

        for (int k = 0; k <= n/2; k++) {
            int i = 0, j = 0;

            first_hasChance = Math.max(first_hasChance, k-1);
            second_hasChance = Math.max(second_hasChance, k-1);

            for (int total = 2*k; total < n; total++) {
                if (first_semi[i] < second_semi[j])
                    first_hasChance = Math.max(first_hasChance, i++);
                else
                    second_hasChance = Math.max(second_hasChance, j++);
            }

            int solvedK = Math.min(i-1, j-1);
            k = Math.max(k, solvedK);
        }

        printArray(first_hasChance, n, out);
        printArray(second_hasChance, n, out);

        out.flush();
    }

    private static void printArray(int k, int n, PrintWriter out) {
        int i = 0;
        for (; i <= k; i++) out.print(1);
        for (; i < n; i++) out.print(0);
        out.println();
    }
}


//package codeforces;

import java.io.PrintWriter;
import java.util.Scanner;

/**
 *
 * @author huseyngasimov
 */
public class Semifinals {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        PrintWriter out = new PrintWriter(System.out);
        int n = in.nextInt();
        int[] first_semi = new int[n];
        int[] second_semi = new int[n];
        int first_hasChance = -1;
        int second_hasChance = -1;

        for (int i = 0; i < n; i++) {
            first_semi[i] = in.nextInt();
            second_semi[i] = in.nextInt();
        }

        for (int k = 0; k <= n/2; k++) {

            first_hasChance = Math.max(first_hasChance, k-1);
            second_hasChance = Math.max(second_hasChance, k-1);

            int i = k, j = k;

            for (int total = 2*k; total < n; total++) {
                if (first_semi[i] < second_semi[j])
                    first_hasChance = Math.max(first_hasChance, i++);
                else
                    second_hasChance = Math.max(second_hasChance, j++);
            }

            //int solvedK = Math.min(i-1, j-1);
            //k = Math.max(k, solvedK);
        }

        printArray(first_hasChance, n, out);
        printArray(second_hasChance, n, out);

        out.flush();
    }

    private static void printArray(int k, int n, PrintWriter out) {
        int i = 0;
        for (; i <= k; i++) out.print(1);
        for (; i < n; i++) out.print(0);
        out.println();
    }
}


import java.util.Arrays;
import java.util.Comparator;
import java.util.Scanner;

public class _378B {
	private static class Sportsmen {
		public final int semifinal;
		public final int pos;
		public long time;

		public Sportsmen(int pos, int semifinal, long time) {
			this.pos = pos;
			this.semifinal = semifinal;
			this.time = time;
		}
	}

	private static Comparator<Sportsmen> timeAsc = new Comparator<Sportsmen>() {
		@Override
		public int compare(Sportsmen o1, Sportsmen o2) {
			return (int) (o1.time - o2.time);
		}
	};

	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);

		int N = scanner.nextInt();
		Sportsmen[] a = new Sportsmen[2 * N];

		for (int i = 0; i < N; i++) {
			a[2 * i] 		= new Sportsmen(i + 1, 1, scanner.nextLong());
			a[2 * i + 1]	= new Sportsmen(i + 1, 2, scanner.nextLong());
		}

		Arrays.sort(a, timeAsc);

		for (int i = 0; i < 2 * N; i++) {
			if (a[i].semifinal == 1) {
				System.out.print(((2 * a[i].pos <= N) || (i < N)) ? "1" : "0");
			}
		}
		System.out.println();
		for (int i = 0; i < 2 * N; i++) {
			if (a[i].semifinal == 2) {
				System.out.print(((2 * a[i].pos <= N) || (i < N)) ? "1" : "0");
			}
		}

		scanner.close();
	}
}


import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
/**
 *
 * @author mark
 */
public class CodeForces222b {

    public static void main(String[] args) throws FileNotFoundException {
        //FileInputStream file = new FileInputStream(new File("/home/mark/tmp/input.txt"));
        //Scanner scan = new Scanner(file);
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        int arr1[] = new int[n];
        int arr2[] = new int[n];
        int ans1[] = new int[n];
        int ans2[] = new int[n];

        for (int i = 0; i < n; i++) {
            arr1[i] = scan.nextInt();
            arr2[i] = scan.nextInt();
        }
        int k = n / 2;

        //Map<Integer,Data> cache = new HashMap<>();

        int n1i = 0;
        int n2i = 0;
        int counter = 0;

        while (counter < n) {
            if (n1i >= n && n2i < n) {
                ans2[n2i] = 1;
                n2i++;
            } else if (n2i >= n && n1i < n) {
                ans1[n1i] = 1;
                n1i++;
            } else if (arr1[n1i] < arr2[n2i]) {
                ans1[n1i] = 1;
                n1i++;
            } else {
                ans2[n2i] = 1;
                n2i++;
            }
            counter++;
        }

        for (int i = 0; i < k; i++) {
            ans1[i] = 1;
            ans2[i] = 1;
        }

        System.out.println(Arrays.toString(ans1).replace("[", "").replace("]", "").replace(",", "").replace(" ", ""));
        System.out.println(Arrays.toString(ans2).replace("[", "").replace("]", "").replace(",", "").replace(" ", ""));
    }
}


import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
/**
 *
 * @author mark
 */
public class CodeForces222b {

    public static void main(String[] args) throws FileNotFoundException {
        FileInputStream file = new FileInputStream(new File("/home/mark/tmp/input.txt"));
        Scanner scan = new Scanner(file);
        //Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        int arr1[] = new int[n];
        int arr2[] = new int[n];
        int ans1[] = new int[n];
        int ans2[] = new int[n];

        for (int i = 0; i < n; i++) {
            arr1[i] = scan.nextInt();
            arr2[i] = scan.nextInt();
        }
        int k = n / 2;

        //Map<Integer,Data> cache = new HashMap<>();

        int n1i = 0;
        int n2i = 0;
        int counter = 0;

        while (counter < n) {
            if (n1i >= n && n2i < n) {
                ans2[n2i] = 1;
                n2i++;
            } else if (n2i >= n && n1i < n) {
                ans1[n1i] = 1;
                n1i++;
            } else if (arr1[n1i] < arr2[n2i]) {
                ans1[n1i] = 1;
                n1i++;
            } else {
                ans2[n2i] = 1;
                n2i++;
            }
            counter++;
        }

        for (int i = 0; i < k; i++) {
            ans1[i] = 1;
            ans2[i] = 1;
        }

        System.out.println(Arrays.toString(ans1).replace("[", "").replace("]", "").replace(",", "").replace(" ", ""));
        System.out.println(Arrays.toString(ans2).replace("[", "").replace("]", "").replace(",", "").replace(" ", ""));
    }
}


import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
/**
 *
 * @author mark
 */
public class CodeForces222b {

    public static void main(String[] args) throws FileNotFoundException {
        //FileInputStream file = new FileInputStream(new File("/home/mark/tmp/input.txt"));
        //Scanner scan = new Scanner(file);
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        int arr1[] = new int[n];
        int arr2[] = new int[n];
        int ans1[] = new int[n];
        int ans2[] = new int[n];

        for (int i = 0; i < n; i++) {
            arr1[i] = scan.nextInt();
            arr2[i] = scan.nextInt();
        }
        int k = n;

        //Map<Integer,Data> cache = new HashMap<>();

        int pn1i=0;
        int pn2i=0;
        int pcounter=0;

        for (int j = 0; j <= k; j += 2) {
            int n1i = 0;
            int n2i = 0;
            int counter = 0;

            if (pcounter>0){
                n1i=pn1i;
                n2i=pn2i;
                counter=pcounter;
            }

            while (counter < n) {
                if (counter < j) {
                    ans1[n1i] = 1;
                    ans2[n2i] = 1;
                    n1i++;
                    n2i++;
                    counter += 2;
                    if (counter>=n){
                        pcounter=counter;
                        pn1i=n1i;
                        pn2i=n2i;
                    }
                } else {
                    if (n1i >= n && n2i < n) {
                        ans2[n2i] = 1;
                        n2i++;
                    } else if (n2i >= n && n1i < n) {
                        ans1[n1i] = 1;
                        n1i++;
                    } else if (arr1[n1i] < arr2[n2i]) {
                        ans1[n1i] = 1;
                        n1i++;
                    } else {
                        ans2[n2i] = 1;
                        n2i++;
                    }
                    counter++;
                }
            }
        }
        System.out.println(Arrays.toString(ans1).replace("[", "").replace("]", "").replace(",", "").replace(" ", ""));
        System.out.println(Arrays.toString(ans2).replace("[", "").replace("]", "").replace(",", "").replace(" ", ""));
    }

    private static class Data {
            int n1i=0;
            int n2i=0;
            int counter=0;

            public Data(int n1i,int n2i,int counter){
                this.n1i=n1i;
                this.n2i=n2i;
                this.counter=counter;
            }

    }
}


import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.util.Arrays;
import java.util.Scanner;

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
/**
 *
 * @author mark
 */
public class CodeForces222b {

    public static void main(String[] args) throws FileNotFoundException {
        //FileInputStream file = new FileInputStream(new File("/home/mark/tmp/input.txt"));
        //Scanner scan = new Scanner(file);
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        int arr1[] = new int[n];
        int arr2[] = new int[n];
        int ans1[] = new int[n];
        int ans2[] = new int[n];

        for (int i = 0; i < n; i++) {
            arr1[i] = scan.nextInt();
            arr2[i] = scan.nextInt();
        }
        int k = n;

        for (int j = 0; j <= k; j+=2) {
            int n1i = 0;
            int n2i = 0;
            int counter = 0;
            while (counter < n) {
                if (counter < j) {
                    ans1[n1i] = 1;
                    ans2[n2i] = 1;
                    n1i++;
                    n2i++;
                    counter+= 2;
                } else {
                    if(n1i>=n && n2i<n){
                        ans2[n2i] = 1;
                        n2i++;
                    }else if (n2i>=n && n1i<n){
                        ans1[n1i] = 1;
                        n1i++;
                    }else if (arr1[n1i] < arr2[n2i]) {
                        ans1[n1i] = 1;
                        n1i++;
                    } else {
                        ans2[n2i] = 1;
                        n2i++;
                    }
                    counter++;
                }
            }
        }
        System.out.println(Arrays.toString(ans1).replace("[", "").replace("]", "").replace(",", ""));
        System.out.println(Arrays.toString(ans2).replace("[", "").replace("]", "").replace(",", ""));
    }
}


import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.util.Arrays;
import java.util.Scanner;

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
/**
 *
 * @author mark
 */
public class CodeForces222b {

    public static void main(String[] args) throws FileNotFoundException {
        //FileInputStream file = new FileInputStream(new File("/home/mark/tmp/input.txt"));
        //Scanner scan = new Scanner(file);
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        int arr1[] = new int[n];
        int arr2[] = new int[n];
        int ans1[] = new int[n];
        int ans2[] = new int[n];

        for (int i = 0; i < n; i++) {
            arr1[i] = scan.nextInt();
            arr2[i] = scan.nextInt();
        }
        int k = n / 2;

        for (int j = 1; j <= k; j++) {
            int n1i = 0;
            int n2i = 0;
            int counter = 0;
            while (counter < n) {
                if (counter < j*2) {
                    ans1[n1i] = 1;
                    ans2[n2i] = 1;
                    n1i++;
                    n2i++;
                    counter += 2;
                } else {
                    if (arr1[n1i] < arr2[n2i]) {
                        ans1[n1i] = 1;
                        n1i++;
                    } else {
                        ans2[n2i] = 1;
                        n2i++;
                    }
                    counter++;
                }
            }
        }
        System.out.println(Arrays.toString(ans1).replace("[", "").replace("]", "").replace(",", ""));
        System.out.println(Arrays.toString(ans2).replace("[", "").replace("]", "").replace(",", ""));
    }
}


import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.util.Arrays;
import java.util.Scanner;

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
/**
 *
 * @author mark
 */
public class CodeForces222b {

    public static void main(String[] args) throws FileNotFoundException {
        //FileInputStream file = new FileInputStream(new File("/home/mark/tmp/input.txt"));
        //Scanner scan = new Scanner(file);
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        int arr1[] = new int[n];
        int arr2[] = new int[n];
        int ans1[] = new int[n];
        int ans2[] = new int[n];

        for (int i = 0; i < n; i++) {
            arr1[i] = scan.nextInt();
            arr2[i] = scan.nextInt();
        }
        int k = n / 2;

        for (int j = 0; j < k; j++) {
            int n1i = 0;
            int n2i = 0;
            int counter = 0;
            while (counter < n) {
                if (counter <= j*2) {
                    ans1[n1i] = 1;
                    ans2[n2i] = 1;
                    n1i++;
                    n2i++;
                    counter += 2;
                } else {
                    if (arr1[n1i] < arr2[n2i]) {
                        ans1[n1i] = 1;
                        n1i++;
                    } else {
                        ans2[n2i] = 1;
                        n2i++;
                    }
                    counter++;
                }
            }
        }
        System.out.println(Arrays.toString(ans1).replace("[", "").replace("]", "").replace(",", ""));
        System.out.println(Arrays.toString(ans2).replace("[", "").replace("]", "").replace(",", ""));
    }
}


import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.util.Arrays;
import java.util.Scanner;

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
/**
 *
 * @author mark
 */
public class CodeForces222b {

    public static void main(String[] args) throws FileNotFoundException {
        //FileInputStream file = new FileInputStream(new File("/home/mark/tmp/input.txt"));
        //Scanner scan = new Scanner(file);
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        int arr1[] = new int[n];
        int arr2[] = new int[n];
        int ans1[] = new int[n];
        int ans2[] = new int[n];

        for (int i = 0; i < n; i++) {
            arr1[i] = scan.nextInt();
            arr2[i] = scan.nextInt();
        }
        int k = n / 2;

        for (int j = 1; j <= k; j++) {
            int n1i = 0;
            int n2i = 0;
            int counter = 0;
            while (counter <= n) {
                if (counter < j*2) {
                    ans1[n1i] = 1;
                    ans2[n2i] = 1;
                    n1i++;
                    n2i++;
                    counter += 2;
                } else {
                    if (arr1[n1i] < arr2[n2i]) {
                        ans1[n1i] = 1;
                        n1i++;
                    } else {
                        ans2[n2i] = 1;
                        n2i++;
                    }
                    counter++;
                }
            }
        }
        System.out.println(Arrays.toString(ans1).replace("[", "").replace("]", "").replace(",", ""));
        System.out.println(Arrays.toString(ans2).replace("[", "").replace("]", "").replace(",", ""));
    }
}


import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
/**
 *
 * @author mark
 */
public class CodeForces222b {

    public static void main(String[] args) throws FileNotFoundException {
        //FileInputStream file = new FileInputStream(new File("/home/mark/tmp/input.txt"));
        //Scanner scan = new Scanner(file);
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        int arr1[] = new int[n];
        int arr2[] = new int[n];
        int ans1[] = new int[n];
        int ans2[] = new int[n];

        for (int i = 0; i < n; i++) {
            arr1[i] = scan.nextInt();
            arr2[i] = scan.nextInt();
        }
        int k = n;

        //Map<Integer,Data> cache = new HashMap<>();

        int pn1i=0;
        int pn2i=0;
        int pcounter=0;

        for (int j = 0; j <= k; j += 2) {
            int n1i = 0;
            int n2i = 0;
            int counter = 0;

            if (pcounter>0){
                n1i=pn1i;
                n2i=pn2i;
            }

            while (counter < n) {
                if (counter < j) {
                    ans1[n1i] = 1;
                    ans2[n2i] = 1;
                    n1i++;
                    n2i++;
                    counter += 2;
                    if (counter>=n){
                        pcounter=counter;
                        pn1i=n1i;
                        pn2i=n2i;
                    }
                } else {
                    if (n1i >= n && n2i < n) {
                        ans2[n2i] = 1;
                        n2i++;
                    } else if (n2i >= n && n1i < n) {
                        ans1[n1i] = 1;
                        n1i++;
                    } else if (arr1[n1i] < arr2[n2i]) {
                        ans1[n1i] = 1;
                        n1i++;
                    } else {
                        ans2[n2i] = 1;
                        n2i++;
                    }
                    counter++;
                }
            }
        }
        System.out.println(Arrays.toString(ans1).replace("[", "").replace("]", "").replace(",", "").replace(" ", ""));
        System.out.println(Arrays.toString(ans2).replace("[", "").replace("]", "").replace(",", "").replace(" ", ""));
    }

    private static class Data {
            int n1i=0;
            int n2i=0;
            int counter=0;

            public Data(int n1i,int n2i,int counter){
                this.n1i=n1i;
                this.n2i=n2i;
                this.counter=counter;
            }

    }
}


import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.util.Arrays;
import java.util.Scanner;

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
/**
 *
 * @author mark
 */
public class CodeForces222b {

    public static void main(String[] args) throws FileNotFoundException {
        //FileInputStream file = new FileInputStream(new File("/home/mark/tmp/input.txt"));
        //Scanner scan = new Scanner(file);
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        int arr1[] = new int[n];
        int arr2[] = new int[n];
        int ans1[] = new int[n];
        int ans2[] = new int[n];

        for (int i = 0; i < n; i++) {
            arr1[i] = scan.nextInt();
            arr2[i] = scan.nextInt();
        }
        int k = n / 2;

        for (int j = 0; j <= k; j++) {
            int n1i = 0;
            int n2i = 0;
            int counter = 0;
            while (counter < n) {
                if (counter < j*2) {
                    ans1[n1i] = 1;
                    ans2[n2i] = 1;
                    n1i++;
                    n2i++;
                    counter += 2;
                } else {
                    if (arr1[n1i] < arr2[n2i]) {
                        ans1[n1i] = 1;
                        n1i++;
                    } else {
                        ans2[n2i] = 1;
                        n2i++;
                    }
                    counter++;
                }
            }
        }
        System.out.println(Arrays.toString(ans1).replace("[", "").replace("]", "").replace(",", ""));
        System.out.println(Arrays.toString(ans2).replace("[", "").replace("]", "").replace(",", ""));
    }
}


import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.util.Arrays;
import java.util.Scanner;

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
/**
 *
 * @author mark
 */
public class CodeForces222b {

    public static void main(String[] args) throws FileNotFoundException {
        //FileInputStream file = new FileInputStream(new File("/home/mark/tmp/input.txt"));
        //Scanner scan = new Scanner(file);
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        int arr1[] = new int[n];
        int arr2[] = new int[n];
        int ans1[] = new int[n];
        int ans2[] = new int[n];

        for (int i = 0; i < n; i++) {
            arr1[i] = scan.nextInt();
            arr2[i] = scan.nextInt();
        }
        int k = n/2;
        for (int j = 0; j <= k; j+=2) {
            int n1i = 0;
            int n2i = 0;
            int counter = 0;
            while (counter < n) {
                if (counter < j) {
                    ans1[n1i] = 1;
                    ans2[n2i] = 1;
                    n1i++;
                    n2i++;
                    counter+= 2;
                } else {
                    if(n1i>=n && n2i<n){
                        ans2[n2i] = 1;
                        n2i++;
                    }else if (n2i>=n && n1i<n){
                        ans1[n1i] = 1;
                        n1i++;
                    }else if (arr1[n1i] < arr2[n2i]) {
                        ans1[n1i] = 1;
                        n1i++;
                    } else {
                        ans2[n2i] = 1;
                        n2i++;
                    }
                    counter++;
                }
            }
        }
        System.out.println(Arrays.toString(ans1).replace("[", "").replace("]", "").replace(",", ""));
        System.out.println(Arrays.toString(ans2).replace("[", "").replace("]", "").replace(",", ""));
    }
}


import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.util.Arrays;
import java.util.Scanner;

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
/**
 *
 * @author mark
 */
public class CodeForces222b {

    public static void main(String[] args) throws FileNotFoundException {
        FileInputStream file = new FileInputStream(new File("/home/mark/tmp/input.txt"));
        Scanner scan = new Scanner(file);
        //Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        int arr1[] = new int[n];
        int arr2[] = new int[n];
        int ans1[] = new int[n];
        int ans2[] = new int[n];

        for (int i = 0; i < n; i++) {
            arr1[i] = scan.nextInt();
            arr2[i] = scan.nextInt();
        }
        int k = n / 2;

        for (int j = 1; j <= k; j++) {
            int n1i = 0;
            int n2i = 0;
            int counter = 0;
            while (counter <= n) {
                if (counter < j*2) {
                    ans1[n1i] = 1;
                    ans2[n2i] = 1;
                    n1i++;
                    n2i++;
                    counter += 2;
                } else {
                    if (arr1[n1i] < arr2[n2i]) {
                        ans1[n1i] = 1;
                        n1i++;
                    } else {
                        ans2[n2i] = 1;
                        n2i++;
                    }
                    counter++;
                }
            }
        }
        System.out.println(Arrays.toString(ans1).replace("[", "").replace("]", "").replace(",", ""));
        System.out.println(Arrays.toString(ans2).replace("[", "").replace("]", "").replace(",", ""));
    }
}


import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.util.Arrays;
import java.util.Scanner;

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
/**
 *
 * @author mark
 */
public class CodeForces222b {

    public static void main(String[] args) throws FileNotFoundException {
        //FileInputStream file = new FileInputStream(new File("/home/mark/tmp/input.txt"));
        //Scanner scan = new Scanner(file);
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        int arr1[] = new int[n];
        int arr2[] = new int[n];
        int ans1[] = new int[n];
        int ans2[] = new int[n];

        for (int i = 0; i < n; i++) {
            arr1[i] = scan.nextInt();
            arr2[i] = scan.nextInt();
        }
        int k = n / 2;

        for (int j = 0; j <= k; j++) {
            int n1i = 0;
            int n2i = 0;
            int counter = 0;
            while (counter < n) {
                if (counter < j*2) {
                    ans1[n1i] = 1;
                    ans2[n2i] = 1;
                    n1i++;
                    n2i++;
                    counter += 2;
                } else {
                    if(n1i>=n && n2i<n){
                        ans2[n2i] = 1;
                        n2i++;
                    }else if (n2i>=n && n1i<n){
                        ans1[n1i] = 1;
                        n1i++;
                    }else if (arr1[n1i] < arr2[n2i]) {
                        ans1[n1i] = 1;
                        n1i++;
                    } else {
                        ans2[n2i] = 1;
                        n2i++;
                    }
                    counter++;
                }
            }
        }
        System.out.println(Arrays.toString(ans1).replace("[", "").replace("]", "").replace(",", ""));
        System.out.println(Arrays.toString(ans2).replace("[", "").replace("]", "").replace(",", ""));
    }
}


import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.util.Arrays;
import java.util.Scanner;

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
/**
 *
 * @author mark
 */
public class CodeForces222b {

    public static void main(String[] args) throws FileNotFoundException {
        FileInputStream file = new FileInputStream(new File("/home/mark/tmp/input.txt"));
        Scanner scan = new Scanner(file);
        //Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        int arr1[] = new int[n];
        int arr2[] = new int[n];
        int ans1[] = new int[n];
        int ans2[] = new int[n];

        for (int i = 0; i < n; i++) {
            arr1[i] = scan.nextInt();
            arr2[i] = scan.nextInt();
        }
        int k = n / 2;

        for (int j = 1; j <= k; j++) {
            int n1i = 0;
            int n2i = 0;
            int counter = 0;
            while (counter < n) {
                if (counter < j*2) {
                    ans1[n1i] = 1;
                    ans2[n2i] = 1;
                    n1i++;
                    n2i++;
                    counter += 2;
                } else {
                    if (arr1[n1i] < arr2[n2i]) {
                        ans1[n1i] = 1;
                        n1i++;
                    } else {
                        ans2[n2i] = 1;
                        n2i++;
                    }
                    counter++;
                }
            }
        }
        System.out.println(Arrays.toString(ans1).replace("[", "").replace("]", "").replace(",", ""));
        System.out.println(Arrays.toString(ans2).replace("[", "").replace("]", "").replace(",", ""));
    }
}


import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.util.Arrays;
import java.util.Scanner;

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
/**
 *
 * @author mark
 */
public class CodeForces222b {

    public static void main(String[] args) throws FileNotFoundException {
        //FileInputStream file = new FileInputStream(new File("/home/mark/tmp/input.txt"));
        //Scanner scan = new Scanner(file);
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        int arr1[] = new int[n];
        int arr2[] = new int[n];
        int ans1[] = new int[n];
        int ans2[] = new int[n];

        for (int i = 0; i < n; i++) {
            arr1[i] = scan.nextInt();
            arr2[i] = scan.nextInt();
        }
        int k = n / 2;

        for (int j = 0; j < k; j++) {
            int n1i = 0;
            int n2i = 0;
            int counter = 0;
            while (counter < n) {
                if (counter < j*2) {
                    ans1[n1i] = 1;
                    ans2[n2i] = 1;
                    n1i++;
                    n2i++;
                    counter += 2;
                } else {
                    if (arr1[n1i] < arr2[n2i]) {
                        ans1[n1i] = 1;
                        n1i++;
                    } else {
                        ans2[n2i] = 1;
                        n2i++;
                    }
                    counter++;
                }
            }
        }
        System.out.println(Arrays.toString(ans1).replace("[", "").replace("]", "").replace(",", ""));
        System.out.println(Arrays.toString(ans2).replace("[", "").replace("]", "").replace(",", ""));
    }
}


import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.util.Arrays;
import java.util.Scanner;

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
/**
 *
 * @author mark
 */
public class CodeForces222b {

    public static void main(String[] args) throws FileNotFoundException {
        FileInputStream file = new FileInputStream(new File("/home/mark/tmp/input.txt"));
        Scanner scan = new Scanner(file);
        //Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        int arr1[] = new int[n];
        int arr2[] = new int[n];
        int ans1[] = new int[n];
        int ans2[] = new int[n];

        for (int i = 0; i < n; i++) {
            arr1[i] = scan.nextInt();
            arr2[i] = scan.nextInt();
        }
        int k = n;

        for (int j = 0; j <= k; j+=2) {
            int n1i = 0;
            int n2i = 0;
            int counter = 0;
            while (counter < n) {
                if (counter < j) {
                    ans1[n1i] = 1;
                    ans2[n2i] = 1;
                    n1i++;
                    n2i++;
                    counter+= 2;
                } else {
                    if(n1i>=n && n2i<n){
                        ans2[n2i] = 1;
                        n2i++;
                    }else if (n2i>=n && n1i<n){
                        ans1[n1i] = 1;
                        n1i++;
                    }else if (arr1[n1i] < arr2[n2i]) {
                        ans1[n1i] = 1;
                        n1i++;
                    } else {
                        ans2[n2i] = 1;
                        n2i++;
                    }
                    counter++;
                }
            }
        }
        System.out.println(Arrays.toString(ans1).replace("[", "").replace("]", "").replace(",", ""));
        System.out.println(Arrays.toString(ans2).replace("[", "").replace("]", "").replace(",", ""));
    }
}


import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.util.Arrays;
import java.util.Scanner;

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
/**
 *
 * @author mark
 */
public class CodeForces222b {

    public static void main(String[] args) throws FileNotFoundException {
        //FileInputStream file = new FileInputStream(new File("/home/mark/tmp/input.txt"));
        //Scanner scan = new Scanner(file);
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        int arr1[] = new int[n];
        int arr2[] = new int[n];
        int ans1[] = new int[n];
        int ans2[] = new int[n];

        for (int i = 0; i < n; i++) {
            arr1[i] = scan.nextInt();
            arr2[i] = scan.nextInt();
        }
        int k = n;

        for (int j = 0; j <= k; j+=2) {
            int n1i = 0;
            int n2i = 0;
            int counter = 0;
            while (counter < n) {
                if (counter < j) {
                    ans1[n1i] = 1;
                    ans2[n2i] = 1;
                    n1i++;
                    n2i++;
                    counter+= 2;
                } else {
                    if(n1i>=n && n2i<n){
                        ans2[n2i] = 1;
                        n2i++;
                    }else if (n2i>=n && n1i<n){
                        ans1[n1i] = 1;
                        n1i++;
                    }else if (arr1[n1i] < arr2[n2i]) {
                        ans1[n1i] = 1;
                        n1i++;
                    } else {
                        ans2[n2i] = 1;
                        n2i++;
                    }
                    counter++;
                }
            }
        }
        System.out.println(Arrays.toString(ans1).replace("[", "").replace("]", "").replace(",", "").replace(" ",""));
        System.out.println(Arrays.toString(ans2).replace("[", "").replace("]", "").replace(",", "").replace(" ",""));
    }
}


import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.util.Arrays;
import java.util.Scanner;

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
/**
 *
 * @author mark
 */
public class CodeForces222b {

    public static void main(String[] args) throws FileNotFoundException {
        //FileInputStream file = new FileInputStream(new File("/home/mark/tmp/input.txt"));
        //Scanner scan = new Scanner(file);
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        int arr1[] = new int[n];
        int arr2[] = new int[n];
        int ans1[] = new int[n];
        int ans2[] = new int[n];

        for (int i = 0; i < n; i++) {
            arr1[i] = scan.nextInt();
            arr2[i] = scan.nextInt();
        }
        int k = n / 2;

        for (int j = 0; j <= k; j++) {
            int n1i = 0;
            int n2i = 0;
            int counter = 0;
            while (counter <= n) {
                if (counter < j*2) {
                    ans1[n1i] = 1;
                    ans2[n2i] = 1;
                    n1i++;
                    n2i++;
                    counter += 2;
                } else {
                    if(n1i>=n && n2i<n){
                        ans2[n2i] = 1;
                        n2i++;
                    }else if (n2i>=n && n1i<n){
                        ans1[n1i] = 1;
                        n1i++;
                    }else if (arr1[n1i] < arr2[n2i]) {
                        ans1[n1i] = 1;
                        n1i++;
                    } else {
                        ans2[n2i] = 1;
                        n2i++;
                    }
                    counter++;
                }
            }
        }
        System.out.println(Arrays.toString(ans1).replace("[", "").replace("]", "").replace(",", ""));
        System.out.println(Arrays.toString(ans2).replace("[", "").replace("]", "").replace(",", ""));
    }
}


import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
/**
 *
 * @author mark
 */
public class CodeForces222b {

    public static void main(String[] args) throws FileNotFoundException {
        //FileInputStream file = new FileInputStream(new File("/home/mark/tmp/input.txt"));
        //Scanner scan = new Scanner(file);
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        int arr1[] = new int[n];
        int arr2[] = new int[n];
        int ans1[] = new int[n];
        int ans2[] = new int[n];

        for (int i = 0; i < n; i++) {
            arr1[i] = scan.nextInt();
            arr2[i] = scan.nextInt();
        }
        int k = n;

        //Map<Integer,Data> cache = new HashMap<>();

        int pn1i=0;
        int pn2i=0;
        int pcounter=0;

        for (int j = 0; j <= k; j += 2) {
            int n1i = 0;
            int n2i = 0;
            int counter = 0;

            if (pcounter>0){
                n1i=pn1i;
                n2i=pn2i;
                counter=pcounter;
            }

            while (counter < n) {
                if (counter < j) {
                    ans1[n1i] = 1;
                    ans2[n2i] = 1;
                    n1i++;
                    n2i++;
                    counter += 2;
                    if (counter>=j){
                        pcounter=counter;
                        pn1i=n1i;
                        pn2i=n2i;
                    }
                } else {
                    if (n1i >= n && n2i < n) {
                        ans2[n2i] = 1;
                        n2i++;
                    } else if (n2i >= n && n1i < n) {
                        ans1[n1i] = 1;
                        n1i++;
                    } else if (arr1[n1i] < arr2[n2i]) {
                        ans1[n1i] = 1;
                        n1i++;
                    } else {
                        ans2[n2i] = 1;
                        n2i++;
                    }
                    counter++;
                }
            }
        }
        System.out.println(Arrays.toString(ans1).replace("[", "").replace("]", "").replace(",", "").replace(" ", ""));
        System.out.println(Arrays.toString(ans2).replace("[", "").replace("]", "").replace(",", "").replace(" ", ""));
    }

    private static class Data {
            int n1i=0;
            int n2i=0;
            int counter=0;

            public Data(int n1i,int n2i,int counter){
                this.n1i=n1i;
                this.n2i=n2i;
                this.counter=counter;
            }

    }
}


import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
/**
 *
 * @author mark
 */
public class CodeForces222b {

    public static void main(String[] args) throws FileNotFoundException {
        //FileInputStream file = new FileInputStream(new File("/home/mark/tmp/input.txt"));
        //Scanner scan = new Scanner(file);
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        int arr1[] = new int[n];
        int arr2[] = new int[n];
        int ans1[] = new int[n];
        int ans2[] = new int[n];

        for (int i = 0; i < n; i++) {
            arr1[i] = scan.nextInt();
            arr2[i] = scan.nextInt();
        }
        int k = n/2;

        //Map<Integer,Data> cache = new HashMap<>();

        int n1i = 0;
        int n2i = 0;
        int counter = 0;

        while (counter < n) {
            if (counter < k) {
                ans1[n1i] = 1;
                ans2[n2i] = 1;
                n1i++;
                n2i++;
                counter += 2;
            } else {
                if (n1i >= n && n2i < n) {
                    ans2[n2i] = 1;
                    n2i++;
                } else if (n2i >= n && n1i < n) {
                    ans1[n1i] = 1;
                    n1i++;
                } else if (arr1[n1i] < arr2[n2i]) {
                    ans1[n1i] = 1;
                    n1i++;
                } else {
                    ans2[n2i] = 1;
                    n2i++;
                }
                counter++;
            }
        }

        for (int i=0;i<k;i++){
            ans1[i]=1;
            ans2[i]=1;
        }

        System.out.println(Arrays.toString(ans1).replace("[", "").replace("]", "").replace(",", "").replace(" ", ""));
        System.out.println(Arrays.toString(ans2).replace("[", "").replace("]", "").replace(",", "").replace(" ", ""));
    }

}


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

public class Semifinals {

    public static void main(String[] args) {
        InputReader in = new InputReader(System.in);

        int n = in.nextInt();
        int[] a = new int[n];
        int[] b = new int[n];

        for (int i = 0; i < n; ++i) {
            a[i] = in.nextInt();
            b[i] = in.nextInt();
        }

        boolean[] hasChanceA = new boolean[n];
        boolean[] hasChanceB = new boolean[n];

        for (int k = 0; k <= n / 2; ++k) {
            for (int i = 0; i < k; ++i) {
                hasChanceA[i] = true;
                hasChanceB[i] = true;
            }

            int i = k;
            int j = k;
            for (int l = 0; l < n - 2 * k; ++l) {
                if (a[i] < b[j]) {
                    hasChanceA[i] = true;
                    ++i;
                } else {
                    hasChanceB[j] = true;
                    ++j;
                }
            }
        }

        StringBuilder ans1 = new StringBuilder();
        StringBuilder ans2 = new StringBuilder();
        for (int i = 0; i < n; ++i) {
            ans1.append(hasChanceA[i] ? "1" : "0");
            ans2.append(hasChanceB[i] ? "1" : "0");
        }

        System.out.println(ans1);
        System.out.println(ans2);
    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream));
            tokenizer = new StringTokenizer("");
        }

        public String next() {
            try {
                while (!tokenizer.hasMoreTokens())
                    tokenizer = new StringTokenizer(reader.readLine());
            } catch (IOException e) {
                throw new RuntimeException(e);
            }

            return tokenizer.nextToken();
        }

        public String nextLine() {
            String line = null;
            try {
                tokenizer = new StringTokenizer("");
                line =  reader.readLine();
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
            return line;
        }

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

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

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

        boolean hasNext() {
            while (!tokenizer.hasMoreTokens()) {
                String line = nextLine();
                if (line == null) return false;
                tokenizer = new StringTokenizer(line);
            }
            return true;
        }
    }
}


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

    public class Semifinals {

        public static void main(String[] args) {
            InputReader in = new InputReader(System.in);

            int n = in.nextInt();
            int[] a = new int[n];
            int[] b = new int[n];

            for (int i = 0; i < n; ++i) {
                a[i] = in.nextInt();
                b[i] = in.nextInt();
            }

            boolean[] hasChanceA = new boolean[n];
            boolean[] hasChanceB = new boolean[n];

            for (int k = 0; k <= n / 2; ++k) {
                for (int i = 0; i < k; ++i) {
                    hasChanceA[i] = true;
                    hasChanceB[i] = true;
                }

                int i = k;
                int j = k;
                for (int l = 0; l < n - 2 * k; ++l) {
                    if (a[i] < b[j]) {
                        hasChanceA[i] = true;
                        ++i;
                    } else {
                        hasChanceB[j] = true;
                        ++j;
                    }
                }
            }

            String ans1 = "";
            String ans2 = "";
            for (int i = 0; i < n; ++i) {
                ans1 += hasChanceA[i] ? "1" : "0";
                ans2 += hasChanceB[i] ? "1" : "0";
            }

            System.out.println(ans1);
            System.out.println(ans2);
        }

        static class InputReader {
            public BufferedReader reader;
            public StringTokenizer tokenizer;

            public InputReader(InputStream stream) {
                reader = new BufferedReader(new InputStreamReader(stream));
                tokenizer = new StringTokenizer("");
            }

            public String next() {
                try {
                    while (!tokenizer.hasMoreTokens())
                        tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }

                return tokenizer.nextToken();
            }

            public String nextLine() {
                String line = null;
                try {
                    tokenizer = new StringTokenizer("");
                    line =  reader.readLine();
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
                return line;
            }

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

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

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

            boolean hasNext() {
                while (!tokenizer.hasMoreTokens()) {
                    String line = nextLine();
                    if (line == null) return false;
                    tokenizer = new StringTokenizer(line);
                }
                return true;
            }
        }
    }


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

public class Semifinals {

    public static void main(String[] args) {
        InputReader in = new InputReader(System.in);

        int n = in.nextInt();
        int[] a = new int[n];
        int[] b = new int[n];

        for (int i = 0; i < n; ++i) {
            a[i] = in.nextInt();
            b[i] = in.nextInt();
        }

        boolean[] hasChanceA = new boolean[n];
        boolean[] hasChanceB = new boolean[n];

        for (int K = 0; K <= 1; ++K) {
            int k = K * n / 2;
            for (int i = 0; i < k; ++i) {
                hasChanceA[i] = true;
                hasChanceB[i] = true;
            }

            int i = k;
            int j = k;
            for (int l = 0; l < n - 2 * k; ++l) {
                if (a[i] < b[j]) {
                    hasChanceA[i] = true;
                    ++i;
                } else {
                    hasChanceB[j] = true;
                    ++j;
                }
            }
        }

        StringBuilder ans1 = new StringBuilder();
        StringBuilder ans2 = new StringBuilder();
        for (int i = 0; i < n; ++i) {
            ans1.append(hasChanceA[i] ? "1" : "0");
            ans2.append(hasChanceB[i] ? "1" : "0");
        }

        System.out.println(ans1);
        System.out.println(ans2);
    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream));
            tokenizer = new StringTokenizer("");
        }

        public String next() {
            try {
                while (!tokenizer.hasMoreTokens())
                    tokenizer = new StringTokenizer(reader.readLine());
            } catch (IOException e) {
                throw new RuntimeException(e);
            }

            return tokenizer.nextToken();
        }

        public String nextLine() {
            String line = null;
            try {
                tokenizer = new StringTokenizer("");
                line =  reader.readLine();
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
            return line;
        }

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

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

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

        boolean hasNext() {
            while (!tokenizer.hasMoreTokens()) {
                String line = nextLine();
                if (line == null) return false;
                tokenizer = new StringTokenizer(line);
            }
            return true;
        }
    }
}


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

public class Semifinals {

    public static void main(String[] args) {
        InputReader in = new InputReader(System.in);

        int n = in.nextInt();
        int[] a = new int[n];
        int[] b = new int[n];

        for (int i = 0; i < n; ++i) {
            a[i] = in.nextInt();
            b[i] = in.nextInt();
        }

        boolean[] hasChanceA = new boolean[n];
        boolean[] hasChanceB = new boolean[n];

        for (int k = 0; k <= n / 2; k += n / 2) {
            for (int i = 0; i < k; ++i) {
                hasChanceA[i] = true;
                hasChanceB[i] = true;
            }

            int i = k;
            int j = k;
            for (int l = 0; l < n - 2 * k; ++l) {
                if (a[i] < b[j]) {
                    hasChanceA[i] = true;
                    ++i;
                } else {
                    hasChanceB[j] = true;
                    ++j;
                }
            }
        }

        StringBuilder ans1 = new StringBuilder();
        StringBuilder ans2 = new StringBuilder();
        for (int i = 0; i < n; ++i) {
            ans1.append(hasChanceA[i] ? "1" : "0");
            ans2.append(hasChanceB[i] ? "1" : "0");
        }

        System.out.println(ans1);
        System.out.println(ans2);
    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream));
            tokenizer = new StringTokenizer("");
        }

        public String next() {
            try {
                while (!tokenizer.hasMoreTokens())
                    tokenizer = new StringTokenizer(reader.readLine());
            } catch (IOException e) {
                throw new RuntimeException(e);
            }

            return tokenizer.nextToken();
        }

        public String nextLine() {
            String line = null;
            try {
                tokenizer = new StringTokenizer("");
                line =  reader.readLine();
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
            return line;
        }

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

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

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

        boolean hasNext() {
            while (!tokenizer.hasMoreTokens()) {
                String line = nextLine();
                if (line == null) return false;
                tokenizer = new StringTokenizer(line);
            }
            return true;
        }
    }
}


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

public class TaskB {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        PrintWriter out = new PrintWriter(System.out);
        int n = in.nextInt();
        int[] a = new int[n];
        int[] b = new int[n];
        for (int i=0;i<n;i++) {
            a[i] = in.nextInt();
            b[i] = in.nextInt();
        }
        boolean[] sa = new boolean[n];
        boolean[] sb = new boolean[n];
        if (n==1) {
            if (a[0]<b[0]) sa[0] = true;
            else sb[0] = true;
        }
        for (int i=0;i<n/2;i++) {
            sa[i] = true;
            sb[i] = true;
        }
        int[] s = new int[2*n];
            int k=0,p=0;
            for (int i=0;i<2*n;i++) {
                if (k < n && p < n && a[k] < b[p]) {
                    s[i] = a[k];
                    k++;
                } else {
                    s[i] = b[p];
                    p++;
                }
            }
        for (int i=0;i<n;i++) {
            int ta = Arrays.binarySearch(a,s[i]);
            int tb = Arrays.binarySearch(b,s[i]);
            if (ta>0) {
                sa[ta] = true;
            }
            if (tb>0) {
                sb[tb] = true;
            }
        }
        int j=n/2;
        while (n>=2 && j<n && a[j]<b[n/2-1]) {
            sa[j] = true;
            j++;
        }
        j = n/2;
        while (n>=2 && j<n && b[j]<a[n/2-1]) {
            sb[j] = true;
            j++;
        }

        for (int i=0;i<n;i++) {
            if (sa[i]) {
                out.print(1);
            } else {
                out.print(0);
            }
        }
        out.println();
        for (int i=0;i<n;i++) {
            if (sb[i]) {
                out.print(1);
            } else {
                out.print(0);
            }
        }
        out.close();
    }
}


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

public class TaskB {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        PrintWriter out = new PrintWriter(System.out);
        int n = in.nextInt();
        int[] a = new int[n];
        int[] b = new int[n];
        for (int i=0;i<n;i++) {
            a[i] = in.nextInt();
            b[i] = in.nextInt();
        }
        boolean[] sa = new boolean[n];
        boolean[] sb = new boolean[n];
        if (n==1) {
            if (a[0]<b[0]) sa[0] = true;
            else sb[0] = true;
        }
        for (int i=0;i<n/2;i++) {
            sa[i] = true;
            sb[i] = true;
        }
        /*for (int i=0;i<=n/2;i++) {
            int k=i,p=i,x=0;
            for (int j=i;j<n && x<n-2*i;j++) {
                if (k < n && p < n && a[k] < b[p]) {
                    sa[k] = true;
                    k++;
                } else {
                    sb[p] = true;
                    p++;
                }
                x++;
            }
        }*/
        int j=n/2;
        while (n>=2 && j<n && a[j]<b[n/2-1]) {
            sa[j] = true;
            j++;
        }
        j = n/2;
        while (n>=2 && j<n && b[j]<a[n/2-1]) {
            sb[j] = true;
            j++;
        }
        for (int i=0;i<n;i++) {
            if (sa[i]) {
                out.print(1);
            } else {
                out.print(0);
            }
        }
        out.println();
        for (int i=0;i<n;i++) {
            if (sb[i]) {
                out.print(1);
            } else {
                out.print(0);
            }
        }
        out.close();
    }
}


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

public class TaskB {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        PrintWriter out = new PrintWriter(System.out);
        int n = in.nextInt();
        int[] a = new int[n];
        int[] b = new int[n];
        for (int i=0;i<n;i++) {
            a[i] = in.nextInt();
            b[i] = in.nextInt();
        }
        boolean[] sa = new boolean[n];
        boolean[] sb = new boolean[n];
        if (n==1) {
            if (a[0]<b[0]) sa[0] = true;
            else sb[0] = true;
        }
        for (int i=0;i<n/2;i++) {
            sa[i] = true;
            sb[i] = true;
        }
        int[] s = new int[2*n];
        int k=0,p=0;
        for (int i=0;i<2*n;i++) {
            if (k < n && p < n && a[k] < b[p]) {
                s[i] = a[k];
                k++;
            } else {
                if (p < n) {
                    s[i] = b[p];
                    p++;
                }
            }
        }
        for (int i=0;i<n;i++) {
            int ta = Arrays.binarySearch(a,s[i]);
            int tb = Arrays.binarySearch(b,s[i]);
            if (ta>0) {
                sa[ta] = true;
            }
            if (tb>0) {
                sb[tb] = true;
            }
        }
        int j=n/2;
        while (n>=2 && j<n && a[j]<b[n/2-1]) {
            sa[j] = true;
            j++;
        }
        j = n/2;
        while (n>=2 && j<n && b[j]<a[n/2-1]) {
            sb[j] = true;
            j++;
        }

        for (int i=0;i<n;i++) {
            if (sa[i]) {
                out.print(1);
            } else {
                out.print(0);
            }
        }
        out.println();
        for (int i=0;i<n;i++) {
            if (sb[i]) {
                out.print(1);
            } else {
                out.print(0);
            }
        }
        out.close();
    }
}


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

public class TaskB {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        PrintWriter out = new PrintWriter(System.out);
        int n = in.nextInt();
        int[] a = new int[n];
        int[] b = new int[n];
        for (int i=0;i<n;i++) {
            a[i] = in.nextInt();
            b[i] = in.nextInt();
        }
        boolean[] sa = new boolean[n];
        boolean[] sb = new boolean[n];
        for (int i=0;i<=n/2;i++) {
            for (int j=0;j<i;j++) {
                sa[j] = true;
                sb[j] = true;
            }
            int k=i,p=i,x=0;
            for (int j=i;j<n && x<n-2*i;j++) {
                if (k < n && p < n && a[k] < b[p]) {
                    sa[k] = true;
                    k++;
                } else {
                    sb[p] = true;
                    p++;
                }
                x++;
            }
        }
        for (int i=0;i<n;i++) {
            if (sa[i]) {
                out.print(1);
            } else {
                out.print(0);
            }
        }
        out.println();
        for (int i=0;i<n;i++) {
            if (sb[i]) {
                out.print(1);
            } else {
                out.print(0);
            }
        }
        out.close();
    }
}


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

public class TaskB {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        PrintWriter out = new PrintWriter(System.out);
        int n = in.nextInt();
        int[] a = new int[n];
        int[] b = new int[n];
        for (int i=0;i<n;i++) {
            a[i] = in.nextInt();
            b[i] = in.nextInt();
        }
        boolean[] sa = new boolean[n];
        boolean[] sb = new boolean[n];
        for (int i=0;i<n/2;i++) {
            sa[i]=sb[i]=true;
        }
        int p=0,k=0;
        for (int i=0;i<n;i++) {
            if (a[p] < b[k]) {
                sa[p++] = true;
            } else {
                sb[k++] = true;
            }
        }
        for (int i=0;i<n;i++) {
            if (sa[i]) {
                out.print(1);
            } else {
                out.print(0);
            }
        }
        out.println();
        for (int i=0;i<n;i++) {
            if (sb[i]) {
                out.print(1);
            } else {
                out.print(0);
            }
        }
        out.close();
    }
}


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

public class TaskB {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        PrintWriter out = new PrintWriter(System.out);
        int n = in.nextInt();
        int[] a = new int[n];
        int[] b = new int[n];
        for (int i=0;i<n;i++) {
            a[i] = in.nextInt();
            b[i] = in.nextInt();
        }
        boolean[] sa = new boolean[n];
        boolean[] sb = new boolean[n];
        for (int i=0;i<n/2;i++) {
            sa[i] = true;
            sb[i] = true;
        }
        /*for (int i=0;i<=n/2;i++) {
            int k=i,p=i,x=0;
            for (int j=i;j<n && x<n-2*i;j++) {
                if (k < n && p < n && a[k] < b[p]) {
                    sa[k] = true;
                    k++;
                } else {
                    sb[p] = true;
                    p++;
                }
                x++;
            }
        }*/
        int j=n/2;
        while (j<n && a[j]<b[n/2-1]) {
            sa[j] = true;
            j++;
        }
        j = n/2;
        while (j<n && b[j]<a[n/2-1]) {
            sb[j] = true;
            j++;
        }
        for (int i=0;i<n;i++) {
            if (sa[i]) {
                out.print(1);
            } else {
                out.print(0);
            }
        }
        out.println();
        for (int i=0;i<n;i++) {
            if (sb[i]) {
                out.print(1);
            } else {
                out.print(0);
            }
        }
        out.close();
    }
}


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

public class TaskB {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        PrintWriter out = new PrintWriter(System.out);
        int n = in.nextInt();
        int[] a = new int[n];
        int[] b = new int[n];
        for (int i=0;i<n;i++) {
            a[i] = in.nextInt();
            b[i] = in.nextInt();
        }
        boolean[] sa = new boolean[n];
        boolean[] sb = new boolean[n];
        for (int i=0;i<n/2;i++) {
            sa[i] = true;
            sb[i] = true;
        }
        for (int i=0;i<=n/2;i++) {
            int k=i,p=i,x=0;
            for (int j=i;j<n && x<n-2*i;j++) {
                if (k < n && p < n && a[k] < b[p]) {
                    sa[k] = true;
                    k++;
                } else {
                    sb[p] = true;
                    p++;
                }
                x++;
            }
        }
        for (int i=0;i<n;i++) {
            if (sa[i]) {
                out.print(1);
            } else {
                out.print(0);
            }
        }
        out.println();
        for (int i=0;i<n;i++) {
            if (sb[i]) {
                out.print(1);
            } else {
                out.print(0);
            }
        }
        out.close();
    }
}


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

public class Main {

    static int binarySearch(int[] arr, int target) {
        int low = 0;
        int high = arr.length;
        int res = -1;
        while (low < high) {
            int mid = low + (high - low) / 2;
            if (arr[mid] <= target) {
                res = mid;
                low = mid + 1;
            } else {
                high = mid;
            }
        }
        return res + 1;
    }

    static String solve(int[] a, int[] b) {
        int n = a.length;
        StringBuilder builder = new StringBuilder(n);
        for (int i = 0; i < n; i++) {
            if ((i + 1) * 2 <= n) {
                builder.append('1');
            } else {
                int pos = i + 1 + binarySearch(b, a[i]);
                if (pos <= n) {
                    builder.append('1');
                } else {
                    builder.append('0');
                }
            }
        }
        return builder.toString();
    }

    public static void main(String[] args) throws Exception {
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        int[] a = new int[n];
        int[] b = new int[n];
        for (int i = 0; i < n; i++) {
            a[i] = scan.nextInt();
            b[i] = scan.nextInt();
        }
        System.out.println(solve(a, b));
        System.out.println(solve(b, a));
    }
}


//package codeforces;

import java.io.File;
import java.io.FileNotFoundException;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.Scanner;

public class Main{
    public static void main(String [] args) throws FileNotFoundException{
       Scanner sc = new Scanner(System.in);
       int n = sc.nextInt();
       int a[] = new int[n];
       int b[] =new int [n];
       int a1[] = new int [n];
       int b1[] = new int [n];

       for(int i=0;i<n;i++){
        a[i] = sc.nextInt();
        b[i] = sc.nextInt();
       sc.nextLine();
       }

       int l=0;
       if(n%2==1) l=1;
       for(int i=n/2;i<n;i++){
           for(int j=0;j<n/2;j++)
        if(b[i]<a[j]) {b1[i]=1; break;}
       }
       for(int i=n/2;i<n;i++){
           for(int j=0;j<n/2;j++)
        if(a[i]<b[j]) {a1[i]=1; break;}
       }

       if(n%2==1) {
        if(a[n/2]<b[n/2+1]) a1[n/2]=1;
        else b1[n/2]=1;
       }

       for(int i=0;i<2;i++){
        for(int j=0;j<n;j++){
         if(i==0){if(j<n/2) System.out.print(1);else System.out.print(a1[j]);}
         else {if(j<n/2) System.out.print(1);else System.out.print(b1[j]);}
        }
        System.out.println();
       }

    }

}


//package codeforces;

import java.io.File;
import java.io.FileNotFoundException;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.Scanner;

public class Main{
    public static void main(String [] args) throws FileNotFoundException{
       Scanner sc = new Scanner(System.in);
       int n = sc.nextInt();
       int a[] = new int[n];
       int b[] =new int [n];
       int a1[] = new int [n];
       int b1[] = new int [n];

       for(int i=0;i<n;i++){
        a[i] = sc.nextInt();
        b[i] = sc.nextInt();
       sc.nextLine();
       }

       int l=0;
       if(n%2==1) l=1;
       for(int i=n/2;i<n;i++){
           for(int j=0;j<n/2;j++)
        if(b[i]<a[j]) {b1[i]=1; break;}
       }
       for(int i=n/2;i<n;i++){
           for(int j=0;j<n/2;j++)
        if(a[i]<b[j]) {a1[i]=1; break;}
       }

       if(n%2==1) {
        if(a[n/2]<b[n/2]) a1[n/2]=1;
        else b1[n/2]=1;
       }

       for(int i=0;i<2;i++){
        for(int j=0;j<n;j++){
         if(i==0){if(j<n/2) System.out.print(1);else System.out.print(a1[j]);}
         else {if(j<n/2) System.out.print(1);else System.out.print(b1[j]);}
        }
        System.out.println();
       }

    }

}


/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

//package codeforces;

import java.util.Scanner;

public class Main{

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int a[] = new int [n];
        int b[] = new int [n];
        int a1[]= new int [n];
        int b1[] = new int[n];

        for(int i=0;i<n;i++){
         a[i] = sc.nextInt();
         b[i] = sc.nextInt();
         sc.nextLine();
        }
  int p =0;int p1=0;

        for(int i=0;i<n;++i){
          if(a[p]<b[p1]) {a1[p]=1;p++;}
          else {b1[p1]=1;p1++;}
        }
        for(int i=0;i<n;i++){
         if(i<n/2) System.out.print(1);
         else System.out.print(a1[i]);
        }
        System.out.println("");
        for(int i=0;i<n;i++){
         if(i<n/2) System.out.print(1);
         else System.out.print(b1[i]);
        }

    }

}


//package codeforces;

import java.io.File;
import java.io.FileNotFoundException;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.Scanner;

public class Main{
    public static void main(String [] args) throws FileNotFoundException{
       Scanner sc = new Scanner(System.in);
       int n = sc.nextInt();
       int a[] = new int[n];
       int b[] =new int [n];
       int a1[] = new int [n];
       int b1[] = new int [n];

       for(int i=0;i<n;i++){
        a[i] = sc.nextInt();
        b[i] = sc.nextInt();
       sc.nextLine();
       }

       int l=0;
       if(n%2==1) l=1;
       boolean ok=true;
       for(int i=n/2;i<n&&ok;i++){
         ok=false;
        for(int j=0;j<n/2;j++){
        if(b[i]<a[j]) {b1[i]=1; ok=true; break;}
        }
       }
       ok=true;
       for(int i=n/2;i<n&&ok;i++){
           ok=false;
           for(int j=0;j<n/2;j++)
        if(a[i]<b[j]) {a1[i]=1;ok=true; break;}
       }

       if(n%2==1) {
        if(a[n/2]<b[n/2]) a1[n/2]=1;
        else b1[n/2]=1;
       }

       for(int i=0;i<2;i++){
        for(int j=0;j<n;j++){
         if(i==0){if(j<n/2) System.out.print(1);else System.out.print(a1[j]);}
         else {if(j<n/2) System.out.print(1);else System.out.print(b1[j]);}
        }
        System.out.println();
       }

    }

}


//package codeforces;

import java.io.File;
import java.io.FileNotFoundException;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.Scanner;

public class Main{
    public static void main(String [] args) throws FileNotFoundException{
       Scanner sc = new Scanner(System.in);
       int n = sc.nextInt();
       int a[] = new int[n];
       int b[] =new int [n];
       int a1[] = new int [n];
       int b1[] = new int [n];

       for(int i=0;i<n;i++){
        a[i] = sc.nextInt();
        b[i] = sc.nextInt();
       sc.nextLine();
       }
       for(int i=n/2;i<n;i++){
           for(int j=0;j<n/2;j++)
        if(b[i]<=a[j]) {b1[i]=1; break;}
       }
       for(int i=n/2;i<n;i++){
           for(int j=0;j<n/2;j++)
        if(a[i]<=b[j]) {a1[i]=1; break;}
       }

       for(int i=0;i<2;i++){
        for(int j=0;j<n;j++){
         if(i==0){if(j<n/2) System.out.print(1);else System.out.print(a1[j]);}
         else {if(j<n/2) System.out.print(1);else System.out.print(b1[j]);}
        }
        System.out.println();
       }

    }

}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class B
{

    public static void main(String[] args)
    {
        MyScanner in = new MyScanner();

        int N = in.nextInt();

        int[] a = new int[N];
        int[] b = new int[N];

        boolean[] afinal = new boolean[N];
        boolean[] bfinal = new boolean[N];

        int kmax = N / 2;

        for (int i = 0; i < N; i++)
        {
            a[i] = in.nextInt();
            b[i] = in.nextInt();

        }

        for (int i = 0; i < kmax; i++)
        {
            afinal[i] = true;
            bfinal[i] = true;
        }

        for (int k = kmax / 2; k <= kmax; k++)
        {
            int left = N - 2 * k;

            int bptr = k;
            int aptr = k;

            while (left > 0)
            {
                if (a[aptr] < b[bptr])
                {
                    afinal[aptr] = true;
                    aptr++;
                }
                else
                {
                    bfinal[bptr] = true;
                    bptr++;
                }
                left--;
            }
        }

        StringBuilder ans = new StringBuilder();
        for (Boolean bool : afinal)
        {
            char c = bool ? '1' : '0';
            ans.append(c);
        }
        System.out.println(ans);

        ans = new StringBuilder();

        for (boolean bool : bfinal)
        {
            char c = bool ? '1' : '0';
            ans.append(c);
        }
        System.out.println(ans);

    }

    //-----------MyScanner class for faster input----------
    public static class MyScanner
    {
        BufferedReader  br;
        StringTokenizer st;

        public MyScanner()
        {
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        String next()
        {
            while (st == null || !st.hasMoreElements())
            {
                try
                {
                    st = new StringTokenizer(br.readLine());
                }
                catch (IOException e)
                {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

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

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

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

        String nextLine()
        {
            String str = "";
            try
            {
                str = br.readLine();
            }
            catch (IOException e)
            {
                e.printStackTrace();
            }
            return str;
        }

    }
    //--------------------------------------------------------
}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class B
{

    public static void main(String[] args)
    {
        MyScanner in = new MyScanner();

        int N = in.nextInt();

        int[] a = new int[N];
        int[] b = new int[N];

        boolean[] afinal = new boolean[N];
        boolean[] bfinal = new boolean[N];

        int kmax = N / 2;

        for (int i = 0; i < N; i++)
        {
            a[i] = in.nextInt();
            b[i] = in.nextInt();

        }

        for (int i = 0; i < kmax; i++)
        {
            afinal[i] = true;
            bfinal[i] = true;
        }

        int bptr = 0;
        int aptr = 0;

        while (N > 0)
        {
            if (a[aptr] < b[bptr])
            {
                afinal[aptr] = true;
                aptr++;
            }
            else
            {
                bfinal[bptr] = true;
                bptr++;
            }
            N--;
        }

        StringBuilder ans = new StringBuilder();
        for (Boolean bool : afinal)
        {
            char c = bool ? '1' : '0';
            ans.append(c);
        }
        System.out.println(ans);

        ans = new StringBuilder();

        for (boolean bool : bfinal)
        {
            char c = bool ? '1' : '0';
            ans.append(c);
        }
        System.out.println(ans);

    }

    //-----------MyScanner class for faster input----------
    public static class MyScanner
    {
        BufferedReader  br;
        StringTokenizer st;

        public MyScanner()
        {
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        String next()
        {
            while (st == null || !st.hasMoreElements())
            {
                try
                {
                    st = new StringTokenizer(br.readLine());
                }
                catch (IOException e)
                {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

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

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

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

        String nextLine()
        {
            String str = "";
            try
            {
                str = br.readLine();
            }
            catch (IOException e)
            {
                e.printStackTrace();
            }
            return str;
        }

    }
    //--------------------------------------------------------
}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class B
{

    public static void main(String[] args)
    {
        MyScanner in = new MyScanner();

        int N = in.nextInt();

        int[] a = new int[N];
        int[] b = new int[N];

        boolean[] afinal = new boolean[N];
        boolean[] bfinal = new boolean[N];

        int kmax = N / 2;

        for (int i = 0; i < N; i++)
        {
            a[i] = in.nextInt();
            b[i] = in.nextInt();

        }

        for (int i = 0; i < kmax; i++)
        {
            afinal[i] = true;
            bfinal[i] = true;
        }

        for (int k = 0; k <= kmax; k++)
        {
            int left = N - 2 * k;

            int bptr = k;
            int aptr = k;

            while (left > 0)
            {
                if (a[aptr] < b[bptr])
                {
                    afinal[aptr] = true;
                    aptr++;
                }
                else
                {
                    bfinal[bptr] = true;
                    bptr++;
                }
                left--;
            }
        }

        StringBuilder ans = new StringBuilder();
        for (Boolean bool : afinal)
        {
            char c = bool ? '1' : '0';
            ans.append(c);
        }
        System.out.println(ans);

        ans = new StringBuilder();

        for (boolean bool : bfinal)
        {
            char c = bool ? '1' : '0';
            ans.append(c);
        }
        System.out.println(ans);

    }

    //-----------MyScanner class for faster input----------
    public static class MyScanner
    {
        BufferedReader  br;
        StringTokenizer st;

        public MyScanner()
        {
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        String next()
        {
            while (st == null || !st.hasMoreElements())
            {
                try
                {
                    st = new StringTokenizer(br.readLine());
                }
                catch (IOException e)
                {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

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

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

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

        String nextLine()
        {
            String str = "";
            try
            {
                str = br.readLine();
            }
            catch (IOException e)
            {
                e.printStackTrace();
            }
            return str;
        }

    }
    //--------------------------------------------------------
}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.math.BigInteger;
import java.util.*;

public class Round260 {

    public static void main(String[] args) {

        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskB solver = new TaskB();
        solver.solve(in, out);
        out.close();
    }
}

/*
 * Am I wrong for thinking out the box from where I stay? Am I wrong for saying
 * that I choose another way?
 *
 * I ain't trying to do what everybody else doing Just cause everybody doing
 * what they all do
 *
 * If one thing I know, I'll fall but I'll grow
 *
 * I'm walking down this road of mine, this road that I call home
 *
 * So am I wrong?
 */

class TaskB {

    public void solve(InputReader in, PrintWriter out) {
        int n = in.nextInt();
        int a[] = new int[n];
        int b[] = new int[n];

        boolean resA[] = new boolean[n];
        boolean resB[] = new boolean[n];

        for (int i = 0; i < n; i++) {
            a[i] = in.nextInt();
            b[i] = in.nextInt();
        }

        int pA = n-1;
        for (int i = 0; i < n; i++) {
            if (b[i] < a[pA])
            {
                resB[i] = true;
                pA--;
            }
        }
        for (int i = 0; i <= pA; i++) {
            resA[i] = true;
        }

        int k = n/2;

        for (int i = 0; i < k; i++) {
            resA[i] = true;
            resB[i] = true;
        }

        StringBuilder ansA = new StringBuilder();
        StringBuilder ansB = new StringBuilder();
        char temp;

        for (int i = 0; i < n; i++) {
            temp = resA[i] ? '1' : '0';
            ansA.append(temp);

            temp = resB[i] ? '1' : '0';
            ansB.append(temp);
        }

        out.println(ansA);
        out.println(ansB);

    }
}

/*
 * For thinking that we could be something for real? Now am I wrong?
 *
 * For trying to reach the things that I can't see?
 *
 * But that's just how I feel,
 *
 * That's just how I feel
 *
 * That's just how I feel
 *
 * Trying to reach the things that I can't see
 */

class InputReader {
    public BufferedReader reader;
    public StringTokenizer tokenizer;

    public InputReader(InputStream stream) {
        reader = new BufferedReader(new InputStreamReader(stream), 32768);
        tokenizer = null;
    }

    public String next() {
        while (tokenizer == null || !tokenizer.hasMoreTokens()) {
            try {
                tokenizer = new StringTokenizer(reader.readLine());
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        return tokenizer.nextToken();
    }

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

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

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


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.math.BigInteger;
import java.util.*;

public class Round260 {

    public static void main(String[] args) {

        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskB solver = new TaskB();
        solver.solve(in, out);
        out.close();
    }
}

/*
 * Am I wrong for thinking out the box from where I stay? Am I wrong for saying
 * that I choose another way?
 *
 * I ain't trying to do what everybody else doing Just cause everybody doing
 * what they all do
 *
 * If one thing I know, I'll fall but I'll grow
 *
 * I'm walking down this road of mine, this road that I call home
 *
 * So am I wrong?
 */

class TaskB {

    public void solve(InputReader in, PrintWriter out) {
        int n = in.nextInt();
        int a[] = new int[n];
        int b[] = new int[n];

        char resA[] = new char[n];
        char resB[] = new char[n];

        Arrays.fill(resA, '0');
        Arrays.fill(resB, '0');

        for (int i = 0; i < n; i++) {
            a[i] = in.nextInt();
            b[i] = in.nextInt();
        }

        int pA = n - 1;
        for (int i = 0; i < n; i++) {
            if (b[i] < a[pA]) {
                resB[i] = '1';
                pA--;
            }
        }

        Arrays.fill(resA, 0, pA + 1, '1');

        int k = n / 2;

        Arrays.fill(resA, 0, k, '1');
        Arrays.fill(resB, 0, k, '1');

        out.println(new String(resA));
        out.println(new String(resB));

    }
}

/*
 * For thinking that we could be something for real? Now am I wrong?
 *
 * For trying to reach the things that I can't see?
 *
 * But that's just how I feel,
 *
 * That's just how I feel
 *
 * That's just how I feel
 *
 * Trying to reach the things that I can't see
 */

class InputReader {
    public BufferedReader reader;
    public StringTokenizer tokenizer;

    public InputReader(InputStream stream) {
        reader = new BufferedReader(new InputStreamReader(stream), 32768);
        tokenizer = null;
    }

    public String next() {
        while (tokenizer == null || !tokenizer.hasMoreTokens()) {
            try {
                tokenizer = new StringTokenizer(reader.readLine());
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        return tokenizer.nextToken();
    }

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

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

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


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.math.BigInteger;
import java.util.*;

public class Round260 {

    public static void main(String[] args) {

        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskB solver = new TaskB();
        solver.solve(in, out);
        out.close();
    }
}

/*
 * Am I wrong for thinking out the box from where I stay? Am I wrong for saying
 * that I choose another way?
 *
 * I ain't trying to do what everybody else doing Just cause everybody doing
 * what they all do
 *
 * If one thing I know, I'll fall but I'll grow
 *
 * I'm walking down this road of mine, this road that I call home
 *
 * So am I wrong?
 */

class TaskB {

    public void solve(InputReader in, PrintWriter out) {
        int n = in.nextInt();
        int a[] = new int[n];
        int b[] = new int[n];

        boolean resA[] = new boolean[n];
        boolean resB[] = new boolean[n];

        for (int i = 0; i < n; ++i) {
            a[i] = in.nextInt();
            b[i] = in.nextInt();
        }

        int pA = n - 1;
        for (int i = 0; i < n; i++) {
            if (b[i] < a[pA]) {
                resB[i] = true;
                pA--;
            }
        }

        Arrays.fill(resA, 0, pA + 1, true);

        int k = n / 2;

        StringBuilder ansA = new StringBuilder();
        StringBuilder ansB = new StringBuilder();
        char temp;

        for (int i = 0; i < n; i++) {
            temp = resA[i] || i < k ? '1' : '0';
            ansA.append(temp);

            temp = resB[i] || i < k ? '1' : '0';
            ansB.append(temp);
        }

        out.println(ansA);
        out.println(ansB);

    }
}

/*
 * For thinking that we could be something for real? Now am I wrong?
 *
 * For trying to reach the things that I can't see?
 *
 * But that's just how I feel,
 *
 * That's just how I feel
 *
 * That's just how I feel
 *
 * Trying to reach the things that I can't see
 */

class InputReader {
    public BufferedReader reader;
    public StringTokenizer tokenizer;

    public InputReader(InputStream stream) {
        reader = new BufferedReader(new InputStreamReader(stream), 32768);
        tokenizer = null;
    }

    public String next() {
        while (tokenizer == null || !tokenizer.hasMoreTokens()) {
            try {
                tokenizer = new StringTokenizer(reader.readLine());
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        return tokenizer.nextToken();
    }

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

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

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