using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Test
{
    class IOHelper : IDisposable
    {
        StreamReader reader;
        StreamWriter writer;

        public IOHelper(string inputFile, string outputFile, Encoding encoding)
        {
            StreamReader iReader;
            StreamWriter oWriter;
            if (inputFile == null)
                iReader = new StreamReader(Console.OpenStandardInput(), encoding);
            else
                iReader = new StreamReader(inputFile, encoding);

            if (outputFile == null)
                oWriter = new StreamWriter(Console.OpenStandardOutput(), encoding);
            else
                oWriter = new StreamWriter(outputFile, false, encoding);

            reader = iReader;
            writer = oWriter;

            curLine = new string[] { };
            curTokenIdx = 0;
        }

        string[] curLine;
        int curTokenIdx;

        char[] whiteSpaces = new char[] { ' ', '\t', '\r', '\n' };

        public string ReadNextToken()
        {
            if (curTokenIdx >= curLine.Length)
            {
                //Read next line
                string line = reader.ReadLine();
                if (line != null)
                    curLine = line.Split(whiteSpaces, StringSplitOptions.RemoveEmptyEntries);
                else
                    curLine = new string[] { };
                curTokenIdx = 0;
            }

            if (curTokenIdx >= curLine.Length)
                return null;

            return curLine[curTokenIdx++];
        }

        public int ReadNextInt()
        {
            return int.Parse(ReadNextToken());
        }

        public double ReadNextDouble()
        {
            var nextToken = ReadNextToken();
            var result = 0.0;
            nextToken = nextToken.Replace(".", System.Threading.Thread.CurrentThread.CurrentCulture.NumberFormat.NumberDecimalSeparator);
            result = double.Parse(nextToken);
            return result;
        }

        public void Write(string stringToWrite)
        {
            writer.Write(stringToWrite);
        }

        public void WriteLine(string stringToWrite)
        {
            writer.WriteLine(stringToWrite);
        }

        public void WriteLine(double valueToWrite)
        {
            long intPart = (long)valueToWrite;
            double fracPart = valueToWrite - intPart;
            var fracPartStr = fracPart.ToString("F8");
            if (fracPartStr.Length > 1)
                fracPartStr = fracPartStr.Substring(2);
            var strToWrite = string.Format("{0}.{1}", intPart, fracPartStr);
            writer.WriteLine(strToWrite);
        }

        public void Dispose()
        {
            try
            {
                if (reader != null)
                {
                    reader.Dispose();
                }
                if (writer != null)
                {
                    writer.Dispose();
                }
            }
            catch { };
        }

        public void Flush()
        {
            if (writer != null)
            {
                writer.Flush();
            }
        }
    }

    class Program
    {
        protected IOHelper ioHelper;

        int n;
        int[] numbers;

        long[] ans;

        public void Solve()
        {
            n = ioHelper.ReadNextInt();
            n /= 2;

            numbers = new int[n];
            ans = new long[2 * n];

            int i;
            for(i=0;i<n;i++)
            {
                numbers[i] = ioHelper.ReadNextInt();
                ans[2 * i + 1] = numbers[i];
            }

            long sqr = 0;
            long x = 0;
            long curSum = 0;
            long root = 0;

            long y = numbers[0];

            long div = 1;
            long bestB = -1;
            long bestX = -1;
            for (; div <= y; div++)
            {
                if (y % div != 0)
                    continue;

                if (y / div > div)
                    continue;

                long b2 = (div + y / div);
                if (b2 % 2 != 0)
                    continue;

                b2 /= 2;

                x = b2 * b2 - y;

                if (x <= 0)
                    continue;

                sqr = b2;

                if(bestB < 0 || b2 < bestB)
                {
                    bestB = b2;
                    bestX = x;
                }
            }
            x = bestX;
            sqr = bestB;
            bool bImposib = false;

            if(x <= 0)
            {
                bImposib = true;
            }

            ans[0] = x;
            curSum = x + numbers[0];
            root = sqr;

            if (!bImposib)
                for (i = 2; i < 2 * n; i += 2)
                {
                    long t = 0;
                    long x4 = ans[i + 1];
                    long a = (long)Math.Sqrt(x4-1);
                    if (x4 % 2 != a % 2)
                        a--;
                    long dv = 0;
                    long bestA = -1;
                    long bestT = -1;
                    for (; dv <= x4; dv++)
                    {
                        if (x4 % dv == 0)
                        {
                            a = x4 / dv;
                            if (a > dv)
                                continue;
                            if ((dv - a)%2 != 0)
                                continue;
                            t = (dv-a) / 2;
                            if (t <= root)
                                continue;
                            if(bestT == -1 || t+a < bestT)
                            {
                                bestT = t+a;
                                bestA = a;
                                break;
                            }
                        }
                    }
                    a = bestA;
                    //t = bestT;

                    if (a * a >= x4 || a <= 0)
                    {
                        bImposib = true;
                        break;
                    }

                    t = (x4 - a * a) / (2 * a);

                    if (t <= root)
                    {
                        bImposib = true;
                        break;
                    }

                    ans[i] = (t - root) * (t + root);
                    if (10000000000000 / (t+root) < (t-root) || ans[i] < 0)
                    {
                        bImposib = true;
                        break;
                    }
                    curSum = t * t + x4;
                    root = t + a;
                }

            if (bImposib)
            {
                ioHelper.WriteLine("No");
            }
            else
            {
                ioHelper.WriteLine("Yes");
                for (i = 0; i < 2 * n; i++)
                    ioHelper.Write(ans[i] + " ");
                ioHelper.WriteLine("");
            }
            ioHelper.Flush();

            //Console.ReadKey();
        }

        public Program(string inputFile, string outputFile)
        {
            ioHelper = new IOHelper(inputFile, outputFile, Encoding.Default);
            Solve();
            ioHelper.Dispose();
        }

        static void Main(string[] args)
        {
            Program myProgram = new Program(null, null);
        }
    }
}


using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Test
{
    class IOHelper : IDisposable
    {
        StreamReader reader;
        StreamWriter writer;

        public IOHelper(string inputFile, string outputFile, Encoding encoding)
        {
            StreamReader iReader;
            StreamWriter oWriter;
            if (inputFile == null)
                iReader = new StreamReader(Console.OpenStandardInput(), encoding);
            else
                iReader = new StreamReader(inputFile, encoding);

            if (outputFile == null)
                oWriter = new StreamWriter(Console.OpenStandardOutput(), encoding);
            else
                oWriter = new StreamWriter(outputFile, false, encoding);

            reader = iReader;
            writer = oWriter;

            curLine = new string[] { };
            curTokenIdx = 0;
        }

        string[] curLine;
        int curTokenIdx;

        char[] whiteSpaces = new char[] { ' ', '\t', '\r', '\n' };

        public string ReadNextToken()
        {
            if (curTokenIdx >= curLine.Length)
            {
                //Read next line
                string line = reader.ReadLine();
                if (line != null)
                    curLine = line.Split(whiteSpaces, StringSplitOptions.RemoveEmptyEntries);
                else
                    curLine = new string[] { };
                curTokenIdx = 0;
            }

            if (curTokenIdx >= curLine.Length)
                return null;

            return curLine[curTokenIdx++];
        }

        public int ReadNextInt()
        {
            return int.Parse(ReadNextToken());
        }

        public double ReadNextDouble()
        {
            var nextToken = ReadNextToken();
            var result = 0.0;
            nextToken = nextToken.Replace(".", System.Threading.Thread.CurrentThread.CurrentCulture.NumberFormat.NumberDecimalSeparator);
            result = double.Parse(nextToken);
            return result;
        }

        public void Write(string stringToWrite)
        {
            writer.Write(stringToWrite);
        }

        public void WriteLine(string stringToWrite)
        {
            writer.WriteLine(stringToWrite);
        }

        public void WriteLine(double valueToWrite)
        {
            long intPart = (long)valueToWrite;
            double fracPart = valueToWrite - intPart;
            var fracPartStr = fracPart.ToString("F8");
            if (fracPartStr.Length > 1)
                fracPartStr = fracPartStr.Substring(2);
            var strToWrite = string.Format("{0}.{1}", intPart, fracPartStr);
            writer.WriteLine(strToWrite);
        }

        public void Dispose()
        {
            try
            {
                if (reader != null)
                {
                    reader.Dispose();
                }
                if (writer != null)
                {
                    writer.Dispose();
                }
            }
            catch { };
        }

        public void Flush()
        {
            if (writer != null)
            {
                writer.Flush();
            }
        }
    }

    class Program
    {
        protected IOHelper ioHelper;

        int n;
        int[] numbers;

        long[] ans;

        public void Solve()
        {
            n = ioHelper.ReadNextInt();
            n /= 2;

            numbers = new int[n];
            ans = new long[2 * n];

            int i;
            for(i=0;i<n;i++)
            {
                numbers[i] = ioHelper.ReadNextInt();
                ans[2 * i + 1] = numbers[i];
            }

            long sqr = 0;
            long x = 0;
            long curSum = 0;
            long root = 0;

            long y = numbers[0];

            long div = 1;
            long bestB = -1;
            long bestX = -1;
            for (; div <= y; div++)
            {
                if (y % div != 0)
                    continue;

                long b2 = (div + y / div);
                if (b2 % 2 != 0)
                    continue;

                b2 /= 2;

                x = b2 * b2 - y;
                sqr = b2;

                if(bestB < 0 || b2 < bestB)
                {
                    bestB = b2;
                    bestX = x;
                }
            }
            x = bestX;
            sqr = bestB;
            bool bImposib = false;

            if(x <= 0)
            {
                bImposib = true;
            }

            ans[0] = x;
            curSum = x + numbers[0];
            root = sqr;

            if (!bImposib)
                for (i = 2; i < 2 * n; i += 2)
                {
                    long t = 0;
                    long x4 = ans[i + 1];
                    long a = (long)Math.Sqrt(x4-1);
                    if (x4 % 2 != a % 2)
                        a--;

                    for (; a > 0; a -= 2)
                    {
                        if (x4 % a == 0)
                        {
                            t = (x4 - a * a) / (2 * a);
                            if (t <= root)
                                continue;
                            break;
                        }
                    }

                    if (a * a >= x4 || a <= 0)
                    {
                        bImposib = true;
                        break;
                    }

                    t = (x4 - a * a) / (2 * a);

                    if (t <= root)
                    {
                        bImposib = true;
                        break;
                    }

                    ans[i] = (t - root) * (t + root);
                    if (10000000000000 / (t+root) < (t-root) || ans[i] < 0)
                    {
                        while (true)
                        {
                            bImposib = true;
                        }
                        break;
                    }
                    curSum = t * t + x4;
                    root = t + a;
                }

            if (bImposib)
            {
                ioHelper.WriteLine("No");
            }
            else
            {
                ioHelper.WriteLine("Yes");
                for (i = 0; i < 2 * n; i++)
                    ioHelper.Write(ans[i] + " ");
                ioHelper.WriteLine("");
            }
            ioHelper.Flush();

            //Console.ReadKey();
        }

        public Program(string inputFile, string outputFile)
        {
            ioHelper = new IOHelper(inputFile, outputFile, Encoding.Default);
            Solve();
            ioHelper.Dispose();
        }

        static void Main(string[] args)
        {
            Program myProgram = new Program(null, null);
        }
    }
}


using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Test
{
    class IOHelper : IDisposable
    {
        StreamReader reader;
        StreamWriter writer;

        public IOHelper(string inputFile, string outputFile, Encoding encoding)
        {
            StreamReader iReader;
            StreamWriter oWriter;
            if (inputFile == null)
                iReader = new StreamReader(Console.OpenStandardInput(), encoding);
            else
                iReader = new StreamReader(inputFile, encoding);

            if (outputFile == null)
                oWriter = new StreamWriter(Console.OpenStandardOutput(), encoding);
            else
                oWriter = new StreamWriter(outputFile, false, encoding);

            reader = iReader;
            writer = oWriter;

            curLine = new string[] { };
            curTokenIdx = 0;
        }

        string[] curLine;
        int curTokenIdx;

        char[] whiteSpaces = new char[] { ' ', '\t', '\r', '\n' };

        public string ReadNextToken()
        {
            if (curTokenIdx >= curLine.Length)
            {
                //Read next line
                string line = reader.ReadLine();
                if (line != null)
                    curLine = line.Split(whiteSpaces, StringSplitOptions.RemoveEmptyEntries);
                else
                    curLine = new string[] { };
                curTokenIdx = 0;
            }

            if (curTokenIdx >= curLine.Length)
                return null;

            return curLine[curTokenIdx++];
        }

        public int ReadNextInt()
        {
            return int.Parse(ReadNextToken());
        }

        public double ReadNextDouble()
        {
            var nextToken = ReadNextToken();
            var result = 0.0;
            nextToken = nextToken.Replace(".", System.Threading.Thread.CurrentThread.CurrentCulture.NumberFormat.NumberDecimalSeparator);
            result = double.Parse(nextToken);
            return result;
        }

        public void Write(string stringToWrite)
        {
            writer.Write(stringToWrite);
        }

        public void WriteLine(string stringToWrite)
        {
            writer.WriteLine(stringToWrite);
        }

        public void WriteLine(double valueToWrite)
        {
            long intPart = (long)valueToWrite;
            double fracPart = valueToWrite - intPart;
            var fracPartStr = fracPart.ToString("F8");
            if (fracPartStr.Length > 1)
                fracPartStr = fracPartStr.Substring(2);
            var strToWrite = string.Format("{0}.{1}", intPart, fracPartStr);
            writer.WriteLine(strToWrite);
        }

        public void Dispose()
        {
            try
            {
                if (reader != null)
                {
                    reader.Dispose();
                }
                if (writer != null)
                {
                    writer.Dispose();
                }
            }
            catch { };
        }

        public void Flush()
        {
            if (writer != null)
            {
                writer.Flush();
            }
        }
    }

    class Program
    {
        protected IOHelper ioHelper;

        int n;
        int[] numbers;

        long[] ans;

        public void Solve()
        {
            n = ioHelper.ReadNextInt();
            n /= 2;

            numbers = new int[n];
            ans = new long[2 * n];

            int i;
            for(i=0;i<n;i++)
            {
                numbers[i] = ioHelper.ReadNextInt();
                ans[2 * i + 1] = numbers[i];
            }

            long sqr = 0;
            long x = 0;
            long curSum = 0;
            long root = 0;

            long y = numbers[0];

            long div = 1;
            long bestB = -1;
            long bestX = -1;
            for (; div <= y; div++)
            {
                if (y % div != 0)
                    continue;

                if (y / div > div)
                    continue;

                long b2 = (div + y / div);
                if (b2 % 2 != 0)
                    continue;

                b2 /= 2;

                x = b2 * b2 - y;

                if (x <= 0)
                    continue;

                sqr = b2;

                if(bestB < 0 || b2 < bestB)
                {
                    bestB = b2;
                    bestX = x;
                }
            }
            x = bestX;
            sqr = bestB;
            bool bImposib = false;

            if(x <= 0)
            {
                bImposib = true;
            }

            ans[0] = x;
            curSum = x + numbers[0];
            root = sqr;

            if (!bImposib)
                for (i = 2; i < 2 * n; i += 2)
                {
                    long t = 0;
                    long x4 = ans[i + 1];
                    long a = (long)Math.Sqrt(x4);
                    if (x4 % 2 != a % 2)
                        a--;
                    long bestA = -1;
                    long bestT = -1;
                    for (; a > 0; a--)
                    {
                        if (x4 % a == 0)
                        {
                            div = x4 / a;
                            if (a > div)
                                continue;
                            if ((div - a)%2 != 0)
                                continue;
                            t = (div-a) / 2;
                            if (t <= root)
                                continue;
                            if(bestT == -1 || t+a < bestT)
                            {
                                bestT = t+a;
                                bestA = a;
                                //break;
                            }
                        }
                    }
                    a = bestA;
                    //t = bestT;

                    if (a * a >= x4 || a <= 0)
                    {
                        bImposib = true;
                        break;
                    }

                    t = (x4 - a * a) / (2 * a);

                    if (t <= root)
                    {
                        bImposib = true;
                        break;
                    }

                    ans[i] = (t - root)*(t + root);
                    if (10000000000000 / (t+root) < (t-root) || ans[i] < 0)
                    {
                        bImposib = true;
                        break;
                    }
                    curSum = t * t + x4;
                    root = t + a;
                }

            if (bImposib)
            {
                ioHelper.WriteLine("No");
            }
            else
            {
                ioHelper.WriteLine("Yes");
                for (i = 0; i < 2 * n; i++)
                    ioHelper.Write(ans[i] + " ");
                ioHelper.WriteLine("");
            }
            ioHelper.Flush();

            //Console.ReadKey();
        }

        public Program(string inputFile, string outputFile)
        {
            ioHelper = new IOHelper(inputFile, outputFile, Encoding.Default);
            Solve();
            ioHelper.Dispose();
        }

        static void Main(string[] args)
        {
            Program myProgram = new Program(null, null);
        }
    }
}


using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Test
{
    class IOHelper : IDisposable
    {
        StreamReader reader;
        StreamWriter writer;

        public IOHelper(string inputFile, string outputFile, Encoding encoding)
        {
            StreamReader iReader;
            StreamWriter oWriter;
            if (inputFile == null)
                iReader = new StreamReader(Console.OpenStandardInput(), encoding);
            else
                iReader = new StreamReader(inputFile, encoding);

            if (outputFile == null)
                oWriter = new StreamWriter(Console.OpenStandardOutput(), encoding);
            else
                oWriter = new StreamWriter(outputFile, false, encoding);

            reader = iReader;
            writer = oWriter;

            curLine = new string[] { };
            curTokenIdx = 0;
        }

        string[] curLine;
        int curTokenIdx;

        char[] whiteSpaces = new char[] { ' ', '\t', '\r', '\n' };

        public string ReadNextToken()
        {
            if (curTokenIdx >= curLine.Length)
            {
                //Read next line
                string line = reader.ReadLine();
                if (line != null)
                    curLine = line.Split(whiteSpaces, StringSplitOptions.RemoveEmptyEntries);
                else
                    curLine = new string[] { };
                curTokenIdx = 0;
            }

            if (curTokenIdx >= curLine.Length)
                return null;

            return curLine[curTokenIdx++];
        }

        public int ReadNextInt()
        {
            return int.Parse(ReadNextToken());
        }

        public double ReadNextDouble()
        {
            var nextToken = ReadNextToken();
            var result = 0.0;
            nextToken = nextToken.Replace(".", System.Threading.Thread.CurrentThread.CurrentCulture.NumberFormat.NumberDecimalSeparator);
            result = double.Parse(nextToken);
            return result;
        }

        public void Write(string stringToWrite)
        {
            writer.Write(stringToWrite);
        }

        public void WriteLine(string stringToWrite)
        {
            writer.WriteLine(stringToWrite);
        }

        public void WriteLine(double valueToWrite)
        {
            long intPart = (long)valueToWrite;
            double fracPart = valueToWrite - intPart;
            var fracPartStr = fracPart.ToString("F8");
            if (fracPartStr.Length > 1)
                fracPartStr = fracPartStr.Substring(2);
            var strToWrite = string.Format("{0}.{1}", intPart, fracPartStr);
            writer.WriteLine(strToWrite);
        }

        public void Dispose()
        {
            try
            {
                if (reader != null)
                {
                    reader.Dispose();
                }
                if (writer != null)
                {
                    writer.Dispose();
                }
            }
            catch { };
        }

        public void Flush()
        {
            if (writer != null)
            {
                writer.Flush();
            }
        }
    }

    class Program
    {
        protected IOHelper ioHelper;

        int n;
        int[] numbers;

        long[] ans;

        public void Solve()
        {
            n = ioHelper.ReadNextInt();
            n /= 2;

            numbers = new int[n];
            ans = new long[2 * n];

            int i;
            for(i=0;i<n;i++)
            {
                numbers[i] = ioHelper.ReadNextInt();
                ans[2 * i + 1] = numbers[i];
            }

            long sqr = 0;
            long x = 0;
            long curSum = 0;
            long root = 0;

            long y = numbers[0];

            long div = 1;
            long bestB = -1;
            long bestX = -1;
            for (; div + div <= y; div++)
            {
                if (y % div != 0)
                    continue;

                long b2 = (div + y / div);
                if (b2 % 2 != 0)
                    continue;

                b2 /= 2;

                x = b2 * b2 - y;
                sqr = b2;

                if(bestB < 0 || b2 < bestB)
                {
                    bestB = b2;
                    bestX = x;
                }
            }
            x = bestX;
            sqr = bestB;
            bool bImposib = false;

            if(x <= 0)
            {
                bImposib = true;
            }

            ans[0] = x;
            curSum = x + numbers[0];
            root = sqr;

            if (!bImposib)
                for (i = 2; i < 2 * n; i += 2)
                {
                    long t = 0;
                    long x4 = ans[i + 1];
                    long a = (long)Math.Sqrt(x4);
                    if (x4 % 2 != a % 2)
                        a--;

                    for (; a > 0; a -= 2)
                    {
                        if (x4 % a == 0)
                        {
                            t = (x4 - a * a) / (2 * a);
                            if (t <= root)
                                continue;
                        }
                    }

                    if (a * a >= x4 || a <= 0)
                    {
                        bImposib = true;
                        break;
                    }

                    t = (x4 - a * a) / (2 * a);

                    if (t <= root)
                    {
                        bImposib = true;
                        break;
                    }

                    ans[i] = (t - root) * (t + root);
                    if (10000000000000 / (t+root) < (t-root) || ans[i] < 0)
                    {
                        bImposib = true;
                        break;
                    }
                    curSum = t * t + x4;
                    root = t + a;
                }

            if (bImposib)
            {
                ioHelper.WriteLine("No");
            }
            else
            {
                ioHelper.WriteLine("Yes");
                for (i = 0; i < 2 * n; i++)
                    ioHelper.Write(ans[i] + ((i!=2*n-1) ? " ": ""));
                ioHelper.WriteLine("");
            }
            ioHelper.Flush();

            //Console.ReadKey();
        }

        public Program(string inputFile, string outputFile)
        {
            ioHelper = new IOHelper(inputFile, outputFile, Encoding.Default);
            Solve();
            ioHelper.Dispose();
        }

        static void Main(string[] args)
        {
            Program myProgram = new Program(null, null);
        }
    }
}


using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Test
{
    class IOHelper : IDisposable
    {
        StreamReader reader;
        StreamWriter writer;

        public IOHelper(string inputFile, string outputFile, Encoding encoding)
        {
            StreamReader iReader;
            StreamWriter oWriter;
            if (inputFile == null)
                iReader = new StreamReader(Console.OpenStandardInput(), encoding);
            else
                iReader = new StreamReader(inputFile, encoding);

            if (outputFile == null)
                oWriter = new StreamWriter(Console.OpenStandardOutput(), encoding);
            else
                oWriter = new StreamWriter(outputFile, false, encoding);

            reader = iReader;
            writer = oWriter;

            curLine = new string[] { };
            curTokenIdx = 0;
        }

        string[] curLine;
        int curTokenIdx;

        char[] whiteSpaces = new char[] { ' ', '\t', '\r', '\n' };

        public string ReadNextToken()
        {
            if (curTokenIdx >= curLine.Length)
            {
                //Read next line
                string line = reader.ReadLine();
                if (line != null)
                    curLine = line.Split(whiteSpaces, StringSplitOptions.RemoveEmptyEntries);
                else
                    curLine = new string[] { };
                curTokenIdx = 0;
            }

            if (curTokenIdx >= curLine.Length)
                return null;

            return curLine[curTokenIdx++];
        }

        public int ReadNextInt()
        {
            return int.Parse(ReadNextToken());
        }

        public double ReadNextDouble()
        {
            var nextToken = ReadNextToken();
            var result = 0.0;
            nextToken = nextToken.Replace(".", System.Threading.Thread.CurrentThread.CurrentCulture.NumberFormat.NumberDecimalSeparator);
            result = double.Parse(nextToken);
            return result;
        }

        public void Write(string stringToWrite)
        {
            writer.Write(stringToWrite);
        }

        public void WriteLine(string stringToWrite)
        {
            writer.WriteLine(stringToWrite);
        }

        public void WriteLine(double valueToWrite)
        {
            long intPart = (long)valueToWrite;
            double fracPart = valueToWrite - intPart;
            var fracPartStr = fracPart.ToString("F8");
            if (fracPartStr.Length > 1)
                fracPartStr = fracPartStr.Substring(2);
            var strToWrite = string.Format("{0}.{1}", intPart, fracPartStr);
            writer.WriteLine(strToWrite);
        }

        public void Dispose()
        {
            try
            {
                if (reader != null)
                {
                    reader.Dispose();
                }
                if (writer != null)
                {
                    writer.Dispose();
                }
            }
            catch { };
        }

        public void Flush()
        {
            if (writer != null)
            {
                writer.Flush();
            }
        }
    }

    class Program
    {
        protected IOHelper ioHelper;

        int n;
        int[] numbers;

        long[] ans;

        public void Solve()
        {
            n = ioHelper.ReadNextInt();
            n /= 2;

            numbers = new int[n];
            ans = new long[2 * n];

            int i;
            for(i=0;i<n;i++)
            {
                numbers[i] = ioHelper.ReadNextInt();
                ans[2 * i + 1] = numbers[i];
            }

            long sqr = 0;
            long x = 0;
            long curSum = 0;
            long root = 0;

            long y = numbers[0];

            long div = 1;
            for (; div + div <= y; div++)
            {
                if (y % div != 0)
                    continue;

                long b2 = (div + y / div);
                if (b2 % 2 != 0)
                    continue;

                b2 /= 2;

                x = b2 * b2 - y;
                sqr = b2;
                break;
            }

            bool bImposib = false;

            if(x <= 0)
            {
                bImposib = true;
            }

            ans[0] = x;
            curSum = x + numbers[0];
            root = sqr;

            if(!bImposib)
            for(i=2;i<2*n;i+=2)
            {
                long t = 0;
                long x4 = ans[i + 1];
                long a = 1;
                if (x4 % 2 == 0)
                    a = 2;

                for(;a*a<x4;a+=2)
                {
                    if (x4 % a == 0)
                        break;
                }

                if(a*a >= x4)
                {
                    bImposib = true;
                    break;
                }

                t = (x4 - a * a) / (2 * a);

                if(t <= root)
                {
                    bImposib = true;
                    break;
                }

                ans[i] = (t - root) * (t + root);
                curSum = t * t + x4;
                root = t + a;
            }

            if (bImposib)
            {
                ioHelper.WriteLine("No");
            }
            else
            {
                for (i = 0; i < 2 * n; i++)
                    ioHelper.Write(ans[i] + " ");
                ioHelper.WriteLine("");
            }
            ioHelper.Flush();

            //Console.ReadKey();
        }

        public Program(string inputFile, string outputFile)
        {
            ioHelper = new IOHelper(inputFile, outputFile, Encoding.Default);
            Solve();
            ioHelper.Dispose();
        }

        static void Main(string[] args)
        {
            Program myProgram = new Program(null, null);
        }
    }
}


using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Test
{
    class IOHelper : IDisposable
    {
        StreamReader reader;
        StreamWriter writer;

        public IOHelper(string inputFile, string outputFile, Encoding encoding)
        {
            StreamReader iReader;
            StreamWriter oWriter;
            if (inputFile == null)
                iReader = new StreamReader(Console.OpenStandardInput(), encoding);
            else
                iReader = new StreamReader(inputFile, encoding);

            if (outputFile == null)
                oWriter = new StreamWriter(Console.OpenStandardOutput(), encoding);
            else
                oWriter = new StreamWriter(outputFile, false, encoding);

            reader = iReader;
            writer = oWriter;

            curLine = new string[] { };
            curTokenIdx = 0;
        }

        string[] curLine;
        int curTokenIdx;

        char[] whiteSpaces = new char[] { ' ', '\t', '\r', '\n' };

        public string ReadNextToken()
        {
            if (curTokenIdx >= curLine.Length)
            {
                //Read next line
                string line = reader.ReadLine();
                if (line != null)
                    curLine = line.Split(whiteSpaces, StringSplitOptions.RemoveEmptyEntries);
                else
                    curLine = new string[] { };
                curTokenIdx = 0;
            }

            if (curTokenIdx >= curLine.Length)
                return null;

            return curLine[curTokenIdx++];
        }

        public int ReadNextInt()
        {
            return int.Parse(ReadNextToken());
        }

        public double ReadNextDouble()
        {
            var nextToken = ReadNextToken();
            var result = 0.0;
            nextToken = nextToken.Replace(".", System.Threading.Thread.CurrentThread.CurrentCulture.NumberFormat.NumberDecimalSeparator);
            result = double.Parse(nextToken);
            return result;
        }

        public void Write(string stringToWrite)
        {
            writer.Write(stringToWrite);
        }

        public void WriteLine(string stringToWrite)
        {
            writer.WriteLine(stringToWrite);
        }

        public void WriteLine(double valueToWrite)
        {
            long intPart = (long)valueToWrite;
            double fracPart = valueToWrite - intPart;
            var fracPartStr = fracPart.ToString("F8");
            if (fracPartStr.Length > 1)
                fracPartStr = fracPartStr.Substring(2);
            var strToWrite = string.Format("{0}.{1}", intPart, fracPartStr);
            writer.WriteLine(strToWrite);
        }

        public void Dispose()
        {
            try
            {
                if (reader != null)
                {
                    reader.Dispose();
                }
                if (writer != null)
                {
                    writer.Dispose();
                }
            }
            catch { };
        }

        public void Flush()
        {
            if (writer != null)
            {
                writer.Flush();
            }
        }
    }

    class Program
    {
        protected IOHelper ioHelper;

        int n;
        int[] numbers;

        long[] ans;

        public void Solve()
        {
            n = ioHelper.ReadNextInt();
            n /= 2;

            numbers = new int[n];
            ans = new long[2 * n];

            int i;
            for(i=0;i<n;i++)
            {
                numbers[i] = ioHelper.ReadNextInt();
                ans[2 * i + 1] = numbers[i];
            }

            long sqr = 0;
            long x = 0;
            long curSum = 0;
            long root = 0;

            long y = numbers[0];

            long div = 1;
            long bestB = -1;
            long bestX = -1;
            for (; div <= y; div++)
            {
                if (y % div != 0)
                    continue;

                if (y / div > div)
                    continue;

                long b2 = (div + y / div);
                if (b2 % 2 != 0)
                    continue;

                b2 /= 2;

                x = b2 * b2 - y;
                sqr = b2;

                if(bestB < 0 || b2 < bestB)
                {
                    bestB = b2;
                    bestX = x;
                }
            }
            x = bestX;
            sqr = bestB;
            bool bImposib = false;

            if(x <= 0)
            {
                bImposib = true;
            }

            ans[0] = x;
            curSum = x + numbers[0];
            root = sqr;

            if (!bImposib)
                for (i = 2; i < 2 * n; i += 2)
                {
                    long t = 0;
                    long x4 = ans[i + 1];
                    long a = (long)Math.Sqrt(x4-1);
                    if (x4 % 2 != a % 2)
                        a--;
                    long dv = x4;
                    long bestA = -1;
                    long bestT = -1;
                    for (; dv > 0; dv--)
                    {
                        if (x4 % dv == 0)
                        {
                            a = x4 / dv;
                            if ((dv - a)%2 != 0)
                                continue;
                            t = dv-a / 2;
                            if (t <= root)
                                continue;
                            if(bestT == -1 || t < bestT)
                            {
                                bestT = t;
                                bestA = a;
                            }
                        }
                    }
                    a = bestA;
                    t = bestT;

                    if (a * a >= x4 || a <= 0)
                    {
                        bImposib = true;
                        break;
                    }

                    //t = (x4 - a * a) / (2 * a);

                    if (t <= root)
                    {
                        bImposib = true;
                        break;
                    }

                    ans[i] = (t - root) * (t + root);
                    if (10000000000000 / (t+root) < (t-root) || ans[i] < 0)
                    {
                        while (true)
                        {
                            bImposib = true;
                        }
                        break;
                    }
                    curSum = t * t + x4;
                    root = t + a;
                }

            if (bImposib)
            {
                ioHelper.WriteLine("No");
            }
            else
            {
                ioHelper.WriteLine("Yes");
                for (i = 0; i < 2 * n; i++)
                    ioHelper.Write(ans[i] + " ");
                ioHelper.WriteLine("");
            }
            ioHelper.Flush();

            //Console.ReadKey();
        }

        public Program(string inputFile, string outputFile)
        {
            ioHelper = new IOHelper(inputFile, outputFile, Encoding.Default);
            Solve();
            ioHelper.Dispose();
        }

        static void Main(string[] args)
        {
            Program myProgram = new Program(null, null);
        }
    }
}


using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Test
{
    class IOHelper : IDisposable
    {
        StreamReader reader;
        StreamWriter writer;

        public IOHelper(string inputFile, string outputFile, Encoding encoding)
        {
            StreamReader iReader;
            StreamWriter oWriter;
            if (inputFile == null)
                iReader = new StreamReader(Console.OpenStandardInput(), encoding);
            else
                iReader = new StreamReader(inputFile, encoding);

            if (outputFile == null)
                oWriter = new StreamWriter(Console.OpenStandardOutput(), encoding);
            else
                oWriter = new StreamWriter(outputFile, false, encoding);

            reader = iReader;
            writer = oWriter;

            curLine = new string[] { };
            curTokenIdx = 0;
        }

        string[] curLine;
        int curTokenIdx;

        char[] whiteSpaces = new char[] { ' ', '\t', '\r', '\n' };

        public string ReadNextToken()
        {
            if (curTokenIdx >= curLine.Length)
            {
                //Read next line
                string line = reader.ReadLine();
                if (line != null)
                    curLine = line.Split(whiteSpaces, StringSplitOptions.RemoveEmptyEntries);
                else
                    curLine = new string[] { };
                curTokenIdx = 0;
            }

            if (curTokenIdx >= curLine.Length)
                return null;

            return curLine[curTokenIdx++];
        }

        public int ReadNextInt()
        {
            return int.Parse(ReadNextToken());
        }

        public double ReadNextDouble()
        {
            var nextToken = ReadNextToken();
            var result = 0.0;
            nextToken = nextToken.Replace(".", System.Threading.Thread.CurrentThread.CurrentCulture.NumberFormat.NumberDecimalSeparator);
            result = double.Parse(nextToken);
            return result;
        }

        public void Write(string stringToWrite)
        {
            writer.Write(stringToWrite);
        }

        public void WriteLine(string stringToWrite)
        {
            writer.WriteLine(stringToWrite);
        }

        public void WriteLine(double valueToWrite)
        {
            long intPart = (long)valueToWrite;
            double fracPart = valueToWrite - intPart;
            var fracPartStr = fracPart.ToString("F8");
            if (fracPartStr.Length > 1)
                fracPartStr = fracPartStr.Substring(2);
            var strToWrite = string.Format("{0}.{1}", intPart, fracPartStr);
            writer.WriteLine(strToWrite);
        }

        public void Dispose()
        {
            try
            {
                if (reader != null)
                {
                    reader.Dispose();
                }
                if (writer != null)
                {
                    writer.Dispose();
                }
            }
            catch { };
        }

        public void Flush()
        {
            if (writer != null)
            {
                writer.Flush();
            }
        }
    }

    class Program
    {
        protected IOHelper ioHelper;

        int n;
        int[] numbers;

        long[] ans;

        public void Solve()
        {
            n = ioHelper.ReadNextInt();
            n /= 2;

            numbers = new int[n];
            ans = new long[2 * n];

            int i;
            for(i=0;i<n;i++)
            {
                numbers[i] = ioHelper.ReadNextInt();
                ans[2 * i + 1] = numbers[i];
            }

            long sqr = 0;
            long x = 0;
            long curSum = 0;
            long root = 0;

            long y = numbers[0];

            long div = 1;
            long bestB = -1;
            long bestX = -1;
            for (; div <= y; div++)
            {
                if (y % div != 0)
                    continue;

                if (y / div > div)
                    continue;

                long b2 = (div + y / div);
                if (b2 % 2 != 0)
                    continue;

                b2 /= 2;

                x = b2 * b2 - y;

                if (x <= 0)
                    continue;

                sqr = b2;

                if(bestB < 0 || b2 < bestB)
                {
                    bestB = b2;
                    bestX = x;
                }
            }
            x = bestX;
            sqr = bestB;
            bool bImposib = false;

            if(x <= 0)
            {
                bImposib = true;
            }

            ans[0] = x;
            curSum = x + numbers[0];
            root = sqr;

            if (!bImposib)
                for (i = 2; i < 2 * n; i += 2)
                {
                    long t = 0;
                    long x4 = ans[i + 1];
                    long a = (long)Math.Sqrt(x4);
                    if (x4 % 2 != a % 2)
                        a--;
                    long bestA = -1;
                    long bestT = -1;
                    for (; a > 0; a--)
                    {
                        if (x4 % a == 0)
                        {
                            div = x4 / a;
                            if (a > div)
                                continue;
                            if ((div - a)%2 != 0)
                                continue;
                            t = (div-a) / 2;
                            if (t <= root)
                                continue;
                            if(bestT == -1 || t+a < bestT)
                            {
                                bestT = t+a;
                                bestA = a;
                                //break;
                            }
                        }
                    }
                    a = bestA;
                    //t = bestT;

                    if (a * a >= x4 || a <= 0)
                    {
                        bImposib = true;
                        break;
                    }

                    t = (x4 - a * a) / (2 * a);

                    if (t <= root)
                    {
                        bImposib = true;
                        break;
                    }

                    ans[i] = (t - root) * (t + root);
                    if (10000000000000 / (t+root) < (t-root) || ans[i] < 0)
                    {
                        bImposib = true;
                        break;
                    }
                    curSum = t * t + x4;
                    root = t + a;
                }

            if (bImposib)
            {
                ioHelper.WriteLine("No");
            }
            else
            {
                ioHelper.WriteLine("Yes");
                for (i = 0; i < 2 * n; i++)
                    ioHelper.Write(ans[i] + " ");
                ioHelper.WriteLine("");
            }
            ioHelper.Flush();

            //Console.ReadKey();
        }

        public Program(string inputFile, string outputFile)
        {
            ioHelper = new IOHelper(inputFile, outputFile, Encoding.Default);
            Solve();
            ioHelper.Dispose();
        }

        static void Main(string[] args)
        {
            Program myProgram = new Program(null, null);
        }
    }
}


using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Test
{
    class IOHelper : IDisposable
    {
        StreamReader reader;
        StreamWriter writer;

        public IOHelper(string inputFile, string outputFile, Encoding encoding)
        {
            StreamReader iReader;
            StreamWriter oWriter;
            if (inputFile == null)
                iReader = new StreamReader(Console.OpenStandardInput(), encoding);
            else
                iReader = new StreamReader(inputFile, encoding);

            if (outputFile == null)
                oWriter = new StreamWriter(Console.OpenStandardOutput(), encoding);
            else
                oWriter = new StreamWriter(outputFile, false, encoding);

            reader = iReader;
            writer = oWriter;

            curLine = new string[] { };
            curTokenIdx = 0;
        }

        string[] curLine;
        int curTokenIdx;

        char[] whiteSpaces = new char[] { ' ', '\t', '\r', '\n' };

        public string ReadNextToken()
        {
            if (curTokenIdx >= curLine.Length)
            {
                //Read next line
                string line = reader.ReadLine();
                if (line != null)
                    curLine = line.Split(whiteSpaces, StringSplitOptions.RemoveEmptyEntries);
                else
                    curLine = new string[] { };
                curTokenIdx = 0;
            }

            if (curTokenIdx >= curLine.Length)
                return null;

            return curLine[curTokenIdx++];
        }

        public int ReadNextInt()
        {
            return int.Parse(ReadNextToken());
        }

        public double ReadNextDouble()
        {
            var nextToken = ReadNextToken();
            var result = 0.0;
            nextToken = nextToken.Replace(".", System.Threading.Thread.CurrentThread.CurrentCulture.NumberFormat.NumberDecimalSeparator);
            result = double.Parse(nextToken);
            return result;
        }

        public void Write(string stringToWrite)
        {
            writer.Write(stringToWrite);
        }

        public void WriteLine(string stringToWrite)
        {
            writer.WriteLine(stringToWrite);
        }

        public void WriteLine(double valueToWrite)
        {
            long intPart = (long)valueToWrite;
            double fracPart = valueToWrite - intPart;
            var fracPartStr = fracPart.ToString("F8");
            if (fracPartStr.Length > 1)
                fracPartStr = fracPartStr.Substring(2);
            var strToWrite = string.Format("{0}.{1}", intPart, fracPartStr);
            writer.WriteLine(strToWrite);
        }

        public void Dispose()
        {
            try
            {
                if (reader != null)
                {
                    reader.Dispose();
                }
                if (writer != null)
                {
                    writer.Dispose();
                }
            }
            catch { };
        }

        public void Flush()
        {
            if (writer != null)
            {
                writer.Flush();
            }
        }
    }

    class Program
    {
        protected IOHelper ioHelper;

        int n;
        int[] numbers;

        long[] ans;

        public void Solve()
        {
            n = ioHelper.ReadNextInt();
            n /= 2;

            numbers = new int[n];
            ans = new long[2 * n];

            int i;
            for(i=0;i<n;i++)
            {
                numbers[i] = ioHelper.ReadNextInt();
                ans[2 * i + 1] = numbers[i];
            }

            long sqr = 0;
            long x = 0;
            long curSum = 0;
            long root = 0;

            long y = numbers[0];

            long div = 1;
            long bestB = -1;
            long bestX = -1;
            for (; div + div <= y; div++)
            {
                if (y % div != 0)
                    continue;

                long b2 = (div + y / div);
                if (b2 % 2 != 0)
                    continue;

                b2 /= 2;

                x = b2 * b2 - y;
                sqr = b2;

                if(bestB < 0 || b2 < bestB)
                {
                    bestB = b2;
                    bestX = x;
                }
            }
            x = bestX;
            sqr = bestB;
            bool bImposib = false;

            if(x <= 0)
            {
                bImposib = true;
            }

            ans[0] = x;
            curSum = x + numbers[0];
            root = sqr;

            if (!bImposib)
                for (i = 2; i < 2 * n; i += 2)
                {
                    long t = 0;
                    long x4 = ans[i + 1];
                    long a = (long)Math.Sqrt(x4-1);
                    if (x4 % 2 != a % 2)
                        a--;

                    for (; a > 0; a -= 2)
                    {
                        if (x4 % a == 0)
                        {
                            t = (x4 - a * a) / (2 * a);
                            if (t <= root)
                                continue;
                            break;
                        }
                    }

                    if (a * a >= x4 || a <= 0)
                    {
                        bImposib = true;
                        break;
                    }

                    t = (x4 - a * a) / (2 * a);

                    if (t <= root)
                    {
                        bImposib = true;
                        break;
                    }

                    ans[i] = (t - root) * (t + root);
                    if (10000000000000 / (t+root) < (t-root) || ans[i] < 0)
                    {
                        bImposib = true;
                        break;
                    }
                    curSum = t * t + x4;
                    root = t + a;
                }

            if (bImposib)
            {
                ioHelper.WriteLine("No");
            }
            else
            {
                ioHelper.WriteLine("Yes");
                for (i = 0; i < 2 * n; i++)
                    ioHelper.Write(ans[i] + ((i!=2*n-1) ? " ": ""));
                ioHelper.WriteLine("");
            }
            ioHelper.Flush();

            //Console.ReadKey();
        }

        public Program(string inputFile, string outputFile)
        {
            ioHelper = new IOHelper(inputFile, outputFile, Encoding.Default);
            Solve();
            ioHelper.Dispose();
        }

        static void Main(string[] args)
        {
            Program myProgram = new Program(null, null);
        }
    }
}


#include <iostream>
#include <bits/stdc++.h>
#define ll long long
#define pb push_back
#define mp make_pair

using namespace std;

int main() {

    ll n; cin>>n;
    ll ar[n];
    ll br[n];

    for(int i = 0;i < n;i++) cin >> ar[i] >> br[i];

    bool fs[n] = {false};
    bool ss[n] = {false};

    for(int i = 1;(2*i) <= n;i++){
        fs[i-1] = true;
        ss[i-1] = true;
    }

    ll cnt = 0;
    ll f = 0,s = 0;
    while(cnt < n){
        if(ar[f] < br[s]){
            fs[f] = true;
            f++;
            cnt++;
        }
        else{
            ss[s] = true;
            s++;
            cnt++;
        }
    }

    for(int i = 0;i < n;i++)cout<<fs[i];
    cout<<"\n";
    for(int i = 0;i < n;i++)cout<<ss[i];
}


#include <iostream>
#include <bits/stdc++.h>
#define ll long long
#define pb push_back
#define mp make_pair

using namespace std;

int main() {

    ll n; cin>>n;
    ll ar[n];
    ll br[n];

    for(int i = 0;i < n;i++) cin >> ar[i] >> br[i];

    bool fs[n] = {false};
    bool ss[n] = {false};

    for(int i = 0;(2*i) < n;i++){
        fs[i] = true;
        ss[i] = true;
    }

    ll cnt = 0;
    ll f = 0,s = 0;
    while(cnt < n){
        if(ar[f] < br[s]){
            fs[f] = true;
            f++;
            cnt++;
        }
        else{
            ss[s] = true;
            s++;
            cnt++;
        }
    }

    for(int i = 0;i < n;i++)cout<<fs[i];
    cout<<"\n";
    for(int i = 0;i < n;i++)cout<<ss[i];
}


// http://codeforces.com/contest/378/problem/B

#include <vector>
#include <iostream>

using namespace std;

int n;
vector<int> a;
vector<int> b;
vector<int> aResult;
vector<int> bResult;

int main() {
	// Input
	cin >> n;
	a.resize(n);
	b.resize(n);
	aResult.resize(n);
	bResult.resize(n);

	for (int i = 0; i < n; i++) {
		cin >> a[i] >> b[i];
	}

	if (n == 1) {
		if (a[0] < b[0]) {
			aResult[0] = 1;
			bResult[0] = 0;
		} else {
			aResult[0] = 0;
			bResult[0] = 1;
		}
	} else {
		for (int i = 0; i < n/2; i++) {
			aResult[i] = bResult[i] = 1;
		}

		for (int i = n/2; i < n; i++) {
			if (a[i] < b[i - n/2 + 1]) {
				aResult[i] = 1;
			} else {
				aResult[i] = 0;
			}
			if (b[i] < a[i - n/2 + 1]) {
				bResult[i] = 1;
			} else {
				bResult[i] = 0;
			}
		}
	}

	for (int i = 0; i < n; i++){
		cout << aResult[i];
	}
	cout << endl;
	for (int i = 0; i < n; i++){
		cout << bResult[i];
	}
	cout << endl;

	return 0;
}


// http://codeforces.com/contest/378/problem/B

#include <vector>
#include <iostream>

using namespace std;

int n;
vector<int> a;
vector<int> b;
vector<int> aResult;
vector<int> bResult;

int main() {
	// Input
	cin >> n;
	a.resize(n);
	b.resize(n);
	aResult.resize(n);
	bResult.resize(n);

	for (int i = 0; i < n; i++) {
		cin >> a[i] >> b[i];
	}

	if (n > 1) {
		for (int i = 0; i < n/2; i++) {
			aResult[i] = bResult[i] = 1;
		}

		for (int i = n/2; i < n; i++) {
			if (a[i] < b[i - n/2 + 1]) {
				aResult[i] = 1;
			} else {
				aResult[i] = 0;
			}
			if (b[i] < a[i - n/2 + 1]) {
				bResult[i] = 1;
			} else {
				bResult[i] = 0;
			}
		}
	}

	for (int i = 0; i < n; i++){
		cout << aResult[i];
	}
	cout << endl;
	for (int i = 0; i < n; i++){
		cout << bResult[i];
	}
	cout << endl;

	return 0;
}


// https://codeforces.com/problemset/problem/378/B

#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int main() {
	int n;
	vector<int> a, b;

	cin >> n;
	a.resize(n);
	b.resize(n);

	for (int i = 0; i < n; i++) {
		cin >> a[i] >> b[i];
	}

	vector<int> res_a, res_b;
  res_a.resize(n);
  res_b.resize(n);

  for (int i = 0; i < n/2; i++) {
    res_a[i] = 1;
    res_b[i] = 1;
  }

  for (int i = n/2; i < n; i++) {
    res_a[i] = (a[i] < b[n - i -1]) ? 1 : 0;
    res_b[i] = (b[i] < a[n -i - 1]) ? 1 : 0;
  }

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

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

	return 0;
}


// http://codeforces.com/contest/378/problem/B

#include <vector>
#include <iostream>

using namespace std;

int n;
vector<int> a;
vector<int> b;
vector<int> aResult;
vector<int> bResult;

int main() {
	// Input
	cin >> n;
	a.resize(n);
	b.resize(n);
	aResult.resize(n);
	bResult.resize(n);

	for (int i = 0; i < n; i++) {
		cin >> a[i] >> b[i];
	}

	for (int i = 0; i < n/2; i++) {
		aResult[i] = bResult[i] = 1;
	}

	if (n > 1) {
		for (int i = n/2; i < n; i++) {
			if (a[i] < b[i - n/2 + 1]) {
				aResult[i] = 1;
			} else {
				aResult[i] = 0;
			}
			if (b[i] < a[i - n/2 + 1]) {
				bResult[i] = 1;
			} else {
				bResult[i] = 0;
			}
		}
	}

	for (int i = 0; i < n; i++){
		cout << aResult[i];
	}
	cout << endl;
	for (int i = 0; i < n; i++){
		cout << bResult[i];
	}
	cout << endl;

	return 0;
}


// http://codeforces.com/contest/378/problem/B

#include <vector>
#include <iostream>

using namespace std;

int n;
vector<int> a;
vector<int> b;
vector<int> aResult;
vector<int> bResult;

int main() {
	// Input
	cin >> n;
	a.resize(n);
	b.resize(n);
	aResult.resize(n);
	bResult.resize(n);

	for (int i = 0; i < n; i++) {
		cin >> a[i] >> b[i];
	}

	// Process
	for (int i = 0; i < n/2; i++) {
		aResult[i] = bResult[i] = 1;
	}

	for (int i = n/2; i < n; i++) {
		if (a[i] < b[i - n/2 + 1]) {
			aResult[i] = 1;
		} else {
			aResult[i] = 0;
		}
		if (b[i] < a[i - n/2 + 1]) {
			bResult[i] = 1;
		} else {
			bResult[i] = 0;
		}
	}

	for (int i = 0; i < n; i++){
		cout << aResult[i];
	}
	cout << endl;
	for (int i = 0; i < n; i++){
		cout << bResult[i];
	}
	cout << endl;

	return 0;
}


// http://codeforces.com/contest/378/problem/B

#include <vector>
#include <iostream>

using namespace std;

int n;
vector<int> a;
vector<int> b;
vector<int> aResult;
vector<int> bResult;

int main() {
	// Input
	cin >> n;
	a.resize(n);
	b.resize(n);
	aResult.resize(n);
	bResult.resize(n);

	for (int i = 0; i < n; i++) {
		cin >> a[i] >> b[i];
	}

	for (int i = 0; i < n/2; i++) {
		aResult[i] = bResult[i] = 1;
	}

	for (int i = n/2; i < n; i++) {
		if (a[i] < b[n - i - 1]) {
			aResult[i] = 1;
		} else {
			aResult[i] = 0;
		}
		if (b[i] < a[n - i -1]) {
			bResult[i] = 1;
		} else {
			bResult[i] = 0;
		}
	}

	for (int i = 0; i < n; i++){
		cout << aResult[i];
	}
	cout << endl;
	for (int i = 0; i < n; i++){
		cout << bResult[i];
	}
	cout << endl;

	return 0;
}


#include <iostream>
#include <vector>
#include <stdio.h>
using namespace std;

int main() {
	int n, temp;
	vector<int>a, b;
	scanf("%d", &n);
	for (int i = 0; i < n; ++i) {
		scanf("%d", &temp);
		a.push_back(temp);
		scanf("%d", &temp);
		b.push_back(temp);
	}
	for (int i = 0; i < n; ++i) {
		if (2 * (i+1) <= n || a[i] < b[n - i])
			printf("1");
		else printf("0");
	}
	printf("\n");
	for (int i = 0; i < n; ++i) {
		if (2 * (i+1) <= n || b[i] < a[n - i])
			printf("1");
		else printf("0");
	}
}


#include <iostream>
#include <vector>
using namespace std;

void display(vector<vector<int>>par) {
	int row = par.size(), col = par[0].size();
	for (int i = 0; i < col; ++i) {
		for (int j = 0; j < row; ++j)
			cout << par[j][i] << " ";
		cout << endl;
	}
}

int min(int a, int b) {
	return (a <= b) ? a : b;
}
int main()
{
	int N, temp;
	vector<vector<int>>par;
	vector<vector<bool>>result;
	vector<int>row;
	vector<bool>row_b;
	cin >> N;
	for (int i = 0; i < N; ++i) row_b.push_back(false);
	for (int i = 0; i < 2; ++i) {
		par.push_back(row);
		result.push_back(row_b);
	}
	for (int i = 0; i<N; ++i) {
		for (int j = 0; j < 2; ++j) {
			cin >> temp;
			par[j].push_back(temp);
		}
	}
	//display(par);
	vector<int>::iterator it;
	for (int k = 0; k <= N / 2; ++k) {

		//extract k players first
		for (int i = 0; i < k; ++i) {
			//from the two semi-finals
			for (int j = 0; j < 2; ++j)
				result[j][i] = true;
		}

		//the best of other players
		if (N - 3 * k>0) {
			int cur1 = k, cur2 = k;
			for (int i = 0; i < N - 3 * k; ++i) {
				if (min(par[0][cur1], par[1][cur2]) == par[0][cur1])
					result[0][cur1++] = true;
				else result[1][cur2++] = true;
			}
		}
	}

	//display
	for (int i = 0; i<2; ++i) {
		for (int j = 0; j<N; ++j) {
			if (result[i][j] == true) cout << 1;
			else cout << 0;
		}
		cout << endl;
	}
	return 0;
}


#include <iostream>
using namespace std;

struct Node {
	int data;
	Node* left, *right;
};

class BST_t {
public:
	// constructor
	BST_t() { root = NULL; }
	// insert a value x into the tree
	bool insert(int x);
	// print the tree in the preorder order
	void preOrder();
	void removeAll();
	~BST_t() { removeAll(); }
private:
	Node * root;
	void preOrderInternal(Node* root);
	void removeAllInternal(Node* root);
};

bool BST_t::insert(int x) {
	if (root == NULL) {
		root = new Node;
		root->data = x;
		root->left = NULL;
		root->right = NULL;
		return true;
	}

	Node* cur = root;
	while (cur)
		if (cur->data == x)
			return false;
		else {
			if (cur->data>x)
				if (cur->left == NULL) {
					cur->left = new Node;
					cur = cur->left;
					cur->left = NULL;
					cur->right = NULL;
					cur->data = x;
					return true;
				}
				else cur = cur->left;
			else
				if (cur->right == NULL) {
					cur->right = new Node;
					cur = cur->right;
					cur->left = NULL;
					cur->right = NULL;
					cur->data = x;
					return true;
				}
				else cur = cur->right;
		}
}

void BST_t::preOrder() {
	if(root!=NULL){
		cout << root->data << " ";
		preOrderInternal(root->left);
		preOrderInternal(root->right);
	}
}

void BST_t::preOrderInternal(Node* root) {
	if (root != NULL) {
		cout << root->data << " ";
		preOrderInternal(root->left);
		preOrderInternal(root->right);
	}
}

void BST_t::removeAll() {
	if(root!=NULL){
		removeAllInternal(root);
		delete root;
		root = NULL;
	}

}

void BST_t::removeAllInternal(Node* root) {
	if (!root)
		return;
	removeAllInternal(root->left);
	removeAllInternal(root->right);
	if (root->left) {
		if (!root->left->left && !root->left->right) {
		delete root->left;
		root->left = NULL;
		}
	}
	if (root->right) {
		if (!root->right->left && !root->right->right) {
		delete root->right;
		root->right = NULL;
		}
	}
}

int main() {
	// your code goes here
	BST_t tree;
	int arr[] = { 100, 70, 120, 110, 85, 61 }, N = 6;
	for (int i = 0; i<N; ++i) tree.insert(arr[i]);
	tree.preOrder();
	tree.removeAll();
	return 0;
}


#include <iostream>
#include <vector>
using namespace std;

void display(vector<vector<int>>par) {
	int row = par.size(), col = par[0].size();
	for (int i = 0; i < col; ++i) {
		for (int j = 0; j < row; ++j)
			cout << par[j][i] << " ";
		cout << endl;
	}
}

int min(int a, int b) {
	return (a <= b) ? a : b;
}
//int main()
//{
//	int N, temp;
//	vector<vector<int>>par;
//	vector<vector<bool>>result;
//	vector<int>row;
//	vector<bool>row_b;
//	cin >> N;
//	for (int i = 0; i < N; ++i) row_b.push_back(false);
//	for (int i = 0; i < 2; ++i) {
//		par.push_back(row);
//		result.push_back(row_b);
//	}
//	for (int i = 0; i<N; ++i) {
//		for (int j = 0; j < 2; ++j) {
//			cin >> temp;
//			par[j].push_back(temp);
//		}
//	}
//	//display(par);
//	vector<int>::iterator it;
//	for (int k = 0; k <= N / 2; ++k) {
//
//		//extract k players first
//		for (int i = 0; i < k; ++i) {
//			//from the two semi-finals
//			for (int j = 0; j < 2; ++j)
//				result[j][i] = true;
//		}
//
//		//the best of other players
//		if (N - 3 * k>0) {
//			int cur1 = k, cur2 = k;
//			for (int i = 0; i < N - 3 * k; ++i) {
//				if (min(par[0][cur1], par[1][cur2]) == par[0][cur1])
//					result[0][cur1++] = true;
//				else result[1][cur2++] = true;
//			}
//		}
//	}
//
//	//display
//	for (int i = 0; i<2; ++i) {
//		for (int j = 0; j<N; ++j) {
//			if (result[i][j] == true) cout << 1;
//			else cout << 0;
//		}
//		cout << endl;
//	}
//	return 0;
//}
int main() {
	int N, temp;
	vector<int>par;
	vector<bool>result;
	cin >> N;
	for (int i = 0; i < 2 * N; ++i) {
		cin >> temp;
		par.push_back(temp);
		result.push_back(false);
	}
	for (int k = 0; k <= N / 2; ++k) {

		//extract k players first
		for (int i = 0; i < k; ++i) {
			result[2 * i] = result[2 * i + 1] = true;
		}

		//the best of other players
		if (N - 3 * k>0) {
			int cur1 = 2 * k, cur2 = 2 * k + 1;
			for (int i = 0; i < N - 3 * k; ++i) {
				if (min(par[cur1], par[cur2]) == par[cur1]) {
					result[cur1] = true;
					cur1 += 2;
				}
				else {
					result[cur2] = true;
					cur2 += 2;
				}
			}
		}
	}

	//display
	for (int i = 0; i<N; ++i) {
		if (result[2 * i] == true) cout << 1;
		else cout << 0;
	}
	cout << endl;
	for (int i = 0; i < N; ++i) {
		if (result[2 * i + 1] == true) cout << 1;
		else cout << 0;
	}
	return 0;
}


#include <iostream>
#include <vector>
using namespace std;

void display(vector<vector<int>>par) {
	int row = par.size(), col = par[0].size();
	for (int i = 0; i < col; ++i) {
		for (int j = 0; j < row; ++j)
			cout << par[j][i] << " ";
		cout << endl;
	}
}

int min(int a, int b) {
	return (a <= b) ? a : b;
}
int main()
{
	int N, temp;
	vector<vector<int>>par;
	vector<vector<bool>>result;
	vector<int>row;
	vector<bool>row_b;
	cin >> N;
	for (int i = 0; i < N; ++i) row_b.push_back(false);
	for (int i = 0; i < 2; ++i) {
		par.push_back(row);
		result.push_back(row_b);
	}
	for (int i = 0; i<N; ++i) {
		for (int j = 0; j < 2; ++j) {
			cin >> temp;
			par[j].push_back(temp);
		}
	}
	//display(par);
	vector<int>::iterator it;
	for (int k = 0; k <= N / 2; ++k) {

		//extract k players first
		for (int i = 0; i < k; ++i) {
			//from the two semi-finals
			for (int j = 0; j < 2; ++j)
				result[j][i] = true;
		}

		//the best of other players
		if (N - 3 * k>0) {
			int cur1 = k, cur2 = k;
			for (int i = 0; i < N - 3 * k; ++i) {
				if (min(par[0][cur1], par[1][cur2]) == par[0][cur1])
					result[0][cur1++] = true;
				else result[1][cur2++] = true;
			}
		}
	}

	//display
	for (int i = 0; i<2; ++i) {
		for (int j = 0; j<N; ++j) {
			if (result[i][j] == true) cout << 1;
			else cout << 0;
		}
		cout << endl;
	}
	system("pause");
	return 0;
}


#include <iostream>
#include <vector>
#include <stdio.h>
using namespace std;

int main() {
	int n, temp;
	vector<int>a, b;
	scanf("%d", &n);
	for (int i = 0; i < n; ++i) {
		scanf("%d", &temp);
		a.push_back(temp);
		scanf("%d", &temp);
		b.push_back(temp);
	}
	for (int i = 0; i < n; ++i) {
		if (2 * (i+1) <= n || a[i] < b[n - 1 - i])
			printf("1");
		else printf("0");
	}
	printf("\n");
	for (int i = 0; i < n; ++i) {
		if (2 * (i+1) <= n || b[i] < a[n - 1 - i])
			printf("1");
		else printf("0");
	}
}


#include<iostream>
#include<bits/stdc++.h>

using namespace std;

int main()
{
    int n;
    cin>>n;
    int a[n][2];
    for(int i=0;i<n;i++){
        cin>>a[i][0]>>a[i][1];
    }
    string semi1,semi2;
    semi1.resize(n);
    semi2.resize(n);
    //char semi1[n],semi2[n];
    fill(semi1.begin(),semi1.begin()+n,'0');
    fill(semi2.begin(),semi2.begin()+n,'0');
    int k=0;
    while(2*k<=n){
        int temp=2*k,row1=k,row2=k;
        fill(semi1.begin(),semi1.begin()+k,'1');
        fill(semi2.begin(),semi2.begin()+k,'1');
        while(temp!=n){
            if(a[row1][0]<a[row2][1]){
                semi1[row1]='1';
                row1++;
                temp++;

            }
            else{
                semi2[row2]='1';
                row2++;
                temp++;
            }
        }
        k++;
    }
    cout<<semi1<<endl<<semi2;
    return 0;
}


#include <iostream>
using namespace std;

int n, i, x, y, a[100100], b[100100];

int main() {
	cin >> n;
	for (i = 0; i < n; ++i)
        cin >> a[i] >> b[i], ++(a[x] < b[y] ? x : y);
	for (i = 0; i < n; ++i)
	 cout << (i < max(x, n / 2) ? '1' : '0');
    cout << endl;
	for (i = 0; i < n; ++i)
	cout << (i < max(y, n / 2) ? '1' : '0');
	 cout << endl;
	return 0;
}


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

typedef long long int ll;
#define endl "\n"
#define pll pair<ll, ll>
#define pii pair<int, int>
#define pb push_back
#define vi vector<int>
#define vl vector<ll>
#define vpii vector<pair<int, int>>
#define mems(x, y) memset(x, y, sizeof(x))
#define all(x) (x).begin(), (x).end()
#define forn(i, s, e) for(int i = s; i < (e); ++i)
#define FASTIO                                                                                \
	ios_base::sync_with_stdio(false);                                                              \
	cin.tie(NULL);
#define FILEIO                                                                                \
	freopen("./input.txt", "r", stdin);                                                            \
	freopen("./output.txt", "w", stdout);
#define debug(...) fprintf(stderr, __VA_ARGS__), fflush(stderr)
#define time__(d)                                                                                \
	for(auto blockTime = make_pair(chrono::high_resolution_clock::now(), true); blockTime.second;  \
		debug("%s : %lld ms\n ",                                                                   \
			  d,                                                                                \
			  chrono::duration_cast<chrono::milliseconds>(chrono::high_resolution_clock::now() -   \
														  blockTime.first)                         \
				  .count()),                                                                       \
			 blockTime.second = false)
const int M = 1e9 + 7;

template <class T>
T ABS(const T& x) {
	return x > 0 ? x : -x;
}
ll gcd(ll n1, ll n2) { return n2 == 0 ? ABS(n1) : gcd(n2, n1 % n2); }
ll lcm(ll n1, ll n2) { return n1 == 0 && n2 == 0 ? 0 : ABS(n1 * n2) / gcd(n1, n2); }
ll ceil2(ll a, ll b) { return (a + b - 1) / b; }

int main() {
	FASTIO
#ifdef LOCAL
	FILEIO
#endif
	int n;
	cin >> n;
	vi a(n), b(n);
	vpii tmp;
	forn(i, 0, n) {
		cin >> a[i] >> b[i];
		tmp.pb({a[i], i});
		tmp.pb({b[i], i + n});
	}
	sort(tmp.begin(), tmp.end());
	int ansa[n], ansb[n];
	mems(ansa, 0);
	mems(ansb, 0);
	for(int i = 0; i < n / 2; ++i) ansa[i] = 1, ansb[i] = 1;

	int i = 1, cnt = 0;
	int prev = tmp[0].first;
	if(tmp[0].second < n) ansa[tmp[0].second] = 1;
	else if(tmp[0].second >= n) {
		ansb[tmp[0].second - n] = 1;
	}
	++cnt;
	while(i < 2 * n && cnt < n) {

		// cout << tmp[i].first << " " << prev << endl;
		if(tmp[i].first == prev) {
			if(tmp[i].second < n) ansa[tmp[i].second] = 1;
			else if(tmp[i].second >= n) {
				ansb[tmp[i].second - n] = 1;
			}
		}
		else {
			prev = tmp[i].first;
			++cnt;
			if(cnt >= n) {
				--cnt;
				break;
			}
			if(tmp[i].second < n) ansa[tmp[i].second] = 1;
			else if(tmp[i].second >= n) {
				ansb[tmp[i].second - n] = 1;
			}
		}
		++i;
	}
	if(cnt < n) {
		if(tmp[i].second < n) ansa[tmp[i].second] = 1;
		else if(tmp[i].second > n) {
			ansb[tmp[i].second - n] = 1;
		}
	}

	forn(i, 0, n) { cout << ansa[i]; }
	cout << endl;
	forn(i, 0, n) { cout << ansb[i]; }

	return 0;
}


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

typedef long long int ll;
#define endl "\n"
#define pll pair<ll, ll>
#define pii pair<int, int>
#define pb push_back
#define vi vector<int>
#define vl vector<ll>
#define vpii vector<pair<int, int>>
#define mems(x, y) memset(x, y, sizeof(x))
#define all(x) (x).begin(), (x).end()
#define forn(i, s, e) for(int i = s; i < (e); ++i)
#define FASTIO                                                                                \
	ios_base::sync_with_stdio(false);                                                              \
	cin.tie(NULL);
#define FILEIO                                                                                \
	freopen("./input.txt", "r", stdin);                                                            \
	freopen("./output.txt", "w", stdout);
#define debug(...) fprintf(stderr, __VA_ARGS__), fflush(stderr)
#define time__(d)                                                                                \
	for(auto blockTime = make_pair(chrono::high_resolution_clock::now(), true); blockTime.second;  \
		debug("%s : %lld ms\n ",                                                                   \
			  d,                                                                                \
			  chrono::duration_cast<chrono::milliseconds>(chrono::high_resolution_clock::now() -   \
														  blockTime.first)                         \
				  .count()),                                                                       \
			 blockTime.second = false)
const int M = 1e9 + 7;

template <class T>
T ABS(const T& x) {
	return x > 0 ? x : -x;
}
ll gcd(ll n1, ll n2) { return n2 == 0 ? ABS(n1) : gcd(n2, n1 % n2); }
ll lcm(ll n1, ll n2) { return n1 == 0 && n2 == 0 ? 0 : ABS(n1 * n2) / gcd(n1, n2); }
ll ceil2(ll a, ll b) { return (a + b - 1) / b; }

int main() {
	FASTIO
#ifdef LOCAL
	FILEIO
#endif
	int n;
	cin >> n;
	vi a(n), b(n);
	vpii tmp;
	forn(i, 0, n) {
		cin >> a[i] >> b[i];
		tmp.pb({a[i], i});
		tmp.pb({b[i], i + n});
	}
	sort(tmp.begin(), tmp.end());
	int ansa[n], ansb[n];
	mems(ansa, 0);
	mems(ansb, 0);
	for(int i = 0; i < n / 2; ++i) ansa[i] = 1, ansb[i] = 1;

	int i = 1, cnt = 0;
	int prev = tmp[0].first;
	if(tmp[0].second < n) ansa[tmp[0].second] = 1;
	else if(tmp[0].second >= n) {
		ansb[tmp[0].second - n] = 1;
	}
	++cnt;
	while(i < 2 * n && cnt < n) {

		// cout << tmp[i].first << " " << prev << endl;
		if(tmp[i].first == prev) {
			if(tmp[i].second < n) ansa[tmp[i].second] = 1;
			else if(tmp[i].second >= n) {
				ansb[tmp[i].second - n] = 1;
			}
		}
		else {
			prev = tmp[i].first;
			++cnt;
			if(cnt >= n) break;
			if(tmp[i].second < n) ansa[tmp[i].second] = 1;
			else if(tmp[i].second >= n) {
				ansb[tmp[i].second - n] = 1;
			}
		}
		++i;
	}
	if(cnt < n) {
		if(tmp[i].second < n) ansa[tmp[i].second] = 1;
		else if(tmp[i].second > n) {
			ansb[tmp[i].second - n] = 1;
		}
	}

	forn(i, 0, n) { cout << ansa[i]; }
	cout << endl;
	forn(i, 0, n) { cout << ansb[i]; }

	return 0;
}


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

typedef long long int ll;
#define endl "\n"
#define pll pair<ll, ll>
#define pii pair<int, int>
#define pb push_back
#define vi vector<int>
#define vl vector<ll>
#define vpii vector<pair<int, int>>
#define mems(x, y) memset(x, y, sizeof(x))
#define all(x) (x).begin(), (x).end()
#define forn(i, s, e) for(int i = s; i < (e); ++i)
#define FASTIO                                                                                \
	ios_base::sync_with_stdio(false);                                                              \
	cin.tie(NULL);
#define FILEIO                                                                                \
	freopen("./input.txt", "r", stdin);                                                            \
	freopen("./output.txt", "w", stdout);
#define debug(...) fprintf(stderr, __VA_ARGS__), fflush(stderr)
#define time__(d)                                                                                \
	for(auto blockTime = make_pair(chrono::high_resolution_clock::now(), true); blockTime.second;  \
		debug("%s : %lld ms\n ",                                                                   \
			  d,                                                                                \
			  chrono::duration_cast<chrono::milliseconds>(chrono::high_resolution_clock::now() -   \
														  blockTime.first)                         \
				  .count()),                                                                       \
			 blockTime.second = false)
const int M = 1e9 + 7;

template <class T>
T ABS(const T& x) {
	return x > 0 ? x : -x;
}
ll gcd(ll n1, ll n2) { return n2 == 0 ? ABS(n1) : gcd(n2, n1 % n2); }
ll lcm(ll n1, ll n2) { return n1 == 0 && n2 == 0 ? 0 : ABS(n1 * n2) / gcd(n1, n2); }
ll ceil2(ll a, ll b) { return (a + b - 1) / b; }

int main() {
	FASTIO
#ifdef LOCAL
	FILEIO
#endif
	int n;
	cin >> n;
	vi a(n), b(n);
	vpii tmp;
	forn(i, 0, n) {
		cin >> a[i] >> b[i];
		tmp.pb({a[i], i});
		tmp.pb({b[i], i + n});
	}
	sort(tmp.begin(), tmp.end());
	int ansa[n], ansb[n];
	mems(ansa, 0);
	mems(ansb, 0);
	for(int i = 0; i < n / 2; ++i) ansa[i] = 1, ansb[i] = 1;

	int i = 1, cnt = 0;
	int prev = tmp[0].first;
	if(tmp[0].second < n) ansa[tmp[0].second] = 1;
	else if(tmp[0].second >= n) {
		ansb[tmp[0].second - n] = 1;
	}
	++cnt;
	while(i < 2 * n && cnt < n) {

		// cout << tmp[i].first << " " << tmp[i].second << endl;
		if(tmp[i].first == prev) {
			if(tmp[i].second < n) ansa[tmp[i].second] = 1;
			else if(tmp[i].second >= n) {
				ansb[tmp[i].second - n] = 1;
			}
		}
		else {
			prev = tmp[i].first;
			++cnt;
			if(cnt >= n) break;
			if(tmp[i].second < n) ansa[tmp[i].second] = 1;
			else if(tmp[i].second >= n) {
				ansb[tmp[i].second - n] = 1;
			}
		}
		++i;
	}
	if(tmp[i].second < n) ansa[tmp[i].second] = 1;
	else if(tmp[i].second > n) {
		ansb[tmp[i].second - n] = 1;
	}

	forn(i, 0, n) { cout << ansa[i]; }
	cout << endl;
	forn(i, 0, n) { cout << ansb[i]; }

	return 0;
}


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

typedef long long int ll;
#define endl "\n"
#define pll pair<ll, ll>
#define pii pair<int, int>
#define pb push_back
#define vi vector<int>
#define vl vector<ll>
#define vpii vector<pair<int, int>>
#define mems(x, y) memset(x, y, sizeof(x))
#define all(x) (x).begin(), (x).end()
#define forn(i, s, e) for(int i = s; i < (e); ++i)
#define FASTIO                                                                                \
	ios_base::sync_with_stdio(false);                                                              \
	cin.tie(NULL);
#define FILEIO                                                                                \
	freopen("./input.txt", "r", stdin);                                                            \
	freopen("./output.txt", "w", stdout);
#define debug(...) fprintf(stderr, __VA_ARGS__), fflush(stderr)
#define time__(d)                                                                                \
	for(auto blockTime = make_pair(chrono::high_resolution_clock::now(), true); blockTime.second;  \
		debug("%s : %lld ms\n ",                                                                   \
			  d,                                                                                \
			  chrono::duration_cast<chrono::milliseconds>(chrono::high_resolution_clock::now() -   \
														  blockTime.first)                         \
				  .count()),                                                                       \
			 blockTime.second = false)
const int M = 1e9 + 7;

template <class T>
T ABS(const T& x) {
	return x > 0 ? x : -x;
}
ll gcd(ll n1, ll n2) { return n2 == 0 ? ABS(n1) : gcd(n2, n1 % n2); }
ll lcm(ll n1, ll n2) { return n1 == 0 && n2 == 0 ? 0 : ABS(n1 * n2) / gcd(n1, n2); }
ll ceil2(ll a, ll b) { return (a + b - 1) / b; }

int main() {
	FASTIO
#ifdef LOCAL
	FILEIO
#endif
	int n;
	cin >> n;
	vi a(n), b(n);
	vpii tmp;
	forn(i, 0, n) {
		cin >> a[i] >> b[i];
		tmp.pb({a[i], i});
		tmp.pb({b[i], i + n});
	}
	sort(tmp.begin(), tmp.end());
	int ansa[n], ansb[n];
	mems(ansa, 0);
	mems(ansb, 0);
	for(int i = 0; i < n / 2; ++i) ansa[i] = 1, ansb[i] = 1;

	for(int i = 0; i < n; ++i) {
		if(tmp[i].second < n) { ansa[tmp[i].second] = 1; }
		else if(tmp[i].second > n) {
			ansb[tmp[i].second - n] = 1;
		}
	}

	forn(i, 0, n) { cout << ansa[i]; }
	cout << endl;
	forn(i, 0, n) { cout << ansb[i]; }

	return 0;
}


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

typedef long long int ll;
#define endl "\n"
#define pll pair<ll, ll>
#define pii pair<int, int>
#define pb push_back
#define vi vector<int>
#define vl vector<ll>
#define vpii vector<pair<int, int>>
#define mems(x, y) memset(x, y, sizeof(x))
#define all(x) (x).begin(), (x).end()
#define forn(i, s, e) for(int i = s; i < (e); ++i)
#define FASTIO                                                                                \
	ios_base::sync_with_stdio(false);                                                              \
	cin.tie(NULL);
#define FILEIO                                                                                \
	freopen("./input.txt", "r", stdin);                                                            \
	freopen("./output.txt", "w", stdout);
#define debug(...) fprintf(stderr, __VA_ARGS__), fflush(stderr)
#define time__(d)                                                                                \
	for(auto blockTime = make_pair(chrono::high_resolution_clock::now(), true); blockTime.second;  \
		debug("%s : %lld ms\n ",                                                                   \
			  d,                                                                                \
			  chrono::duration_cast<chrono::milliseconds>(chrono::high_resolution_clock::now() -   \
														  blockTime.first)                         \
				  .count()),                                                                       \
			 blockTime.second = false)
const int M = 1e9 + 7;

template <class T>
T ABS(const T& x) {
	return x > 0 ? x : -x;
}
ll gcd(ll n1, ll n2) { return n2 == 0 ? ABS(n1) : gcd(n2, n1 % n2); }
ll lcm(ll n1, ll n2) { return n1 == 0 && n2 == 0 ? 0 : ABS(n1 * n2) / gcd(n1, n2); }
ll ceil2(ll a, ll b) { return (a + b - 1) / b; }

int main() {
	FASTIO
#ifdef LOCAL
	FILEIO
#endif
	int n;
	cin >> n;
	vi a(n), b(n);
	vpii tmp;
	forn(i, 0, n) {
		cin >> a[i] >> b[i];
		tmp.pb({a[i], i});
		tmp.pb({b[i], i + n});
	}
	sort(tmp.begin(), tmp.end());
	int ansa[n], ansb[n];
	mems(ansa, 0);
	mems(ansb, 0);
	for(int i = 0; i < (n + 1) / 2; ++i) ansa[i] = 1, ansb[i] = 1;

	for(int i = 0; i < n; ++i) {
		if(tmp[i].second < n) { ansa[tmp[i].second] = 1; }
		else if(tmp[i].second > n) {
			ansb[tmp[i].second - n] = 1;
		}
	}

	forn(i, 0, n) { cout << ansa[i]; }
	cout << endl;
	forn(i, 0, n) { cout << ansb[i]; }

	return 0;
}


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

int main(){
int n; cin >> n;
map<int, int> m;
int arr[2*n], arr1[n], arr2[n];
for(int i = 0; i < n; i++){
    cin >> arr[i] >> arr[n+i];
    arr1[i] = arr[i]; arr2[i] = arr[n+i];
    if(i < 2) m[arr[i]] = 1, m[arr[n+i]] = 1;
    else m[arr[i]] = 0, m[arr[i+n]] = 0;
}
sort(arr, arr+2*n);
m[arr[0]] = 1, m[arr[1]] = 1, m[arr[2]] = 1, m[arr[3]] = 1;
for(int i = 0; i < n; i++){cout<<(m[arr1[i]] == 1 ? 1 : 0);}
cout << endl;
for(int i = 0; i < n; i++){cout<<(m[arr2[i]] == 1 ? 1 : 0);}

}


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

int main(){
int n; cin >> n;
map<int, int> m;
int arr[2*n], arr1[n], arr2[n];
for(int i = 0; i < n; i++){
    cin >> arr[i] >> arr[n+i];
    arr1[i] = arr[i]; arr2[i] = arr[n+i];
    if(i < n/2) m[arr[i]] = 1, m[arr[n+i]] = 1;
    else m[arr[i]] = 0, m[arr[i+n]] = 0;
}
sort(arr, arr+2*n);
for(int k = 0; k < n; k++){
    m[arr[k]] = 1;
}
for(int i = 0; i < n; i++){cout<<(m[arr1[i]] == 1 ? 1 : 0);}
cout << endl;
for(int i = 0; i < n; i++){cout<<(m[arr2[i]] == 1 ? 1 : 0);}

}


#include<bits/stdc++.h>
#define god dimasi5eks
#pragma GCC optimize("O3")
#define fi first
#define se second
#define pb push_back
#define pf push_front
#define mod 1000000007

using namespace std;

typedef long long ll;

int n, ta[100002], tb[100002];

bool ok[100002], ok2[100002];
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cin >> n;
    for(int i = 1; i <= n; ++i)
        cin >> ta[i] >> tb[i];
    for(int i = 1; i <= n; ++i)
    {
        if(i <= n/2)
            ok[i] = ok2[i] = 1;
        else
        {
            int st = 1;
            int dr = n;
            int bst = 0;
            while(st <= dr)
            {
                int mid = (st + dr) / 2;
                if(ta[mid] < tb[i])
                    bst = mid, st = mid + 1;
                else
                    dr = mid - 1;
            }
            int k = min(i - 1, bst);
            if(i + bst - 2 * k <= n - 2 * k)
                ok2[i] = 1;
            st = 1;
            dr = n;
            bst = 0;
            while(st <= dr)
            {
                int mid = (st + dr) / 2;
                if(tb[mid] < ta[i])
                    bst = mid, st = mid + 1;
                else
                    dr = mid - 1;
            }
            k = min(i - 1, bst);
            if(i + bst - 2 * k <= n - 2 * k)
                ok[i] = 1;
        }
    }
    for(int i = 1; i <= n; ++i)
        cout << ok[i];
    cout << '\n';
    for(int i = 1; i <= n; ++i)
        cout << ok2[i];
    return 0;
}


#include<bits/stdc++.h>
#define god dimasi5eks
#pragma GCC optimize("O3")
#define fi first
#define se second
#define pb push_back
#define pf push_front
#define mod 1000000007

using namespace std;

typedef long long ll;

int n, ta[100002], tb[100002];

bool ok[100002], ok2[100002];
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cin >> n;
    for(int i = 1; i <= n; ++i)
        cin >> ta[i] >> tb[i];
    for(int i = 1; i <= n; ++i)
    {
        if(i <= n/2)
            ok[i] = ok2[i] = 1;
        else
        {
            int st = 1;
            int dr = n;
            int bst = 0;
            while(st <= dr)
            {
                int mid = (st + dr) / 2;
                if(ta[mid] < tb[i])
                    bst = mid, st = mid + 1;
                else
                    dr = mid - 1;
            }
            int k = min(i - 1, bst);
            if(bst - k + 1 <= n - 2 * k)
                ok2[i] = 1;
            st = 1;
            dr = n;
            bst = 0;
            while(st <= dr)
            {
                int mid = (st + dr) / 2;
                if(tb[mid] < ta[i])
                    bst = mid, st = mid + 1;
                else
                    dr = mid - 1;
            }
            k = min(i - 1, bst);
            if(bst - k + 1 <= n - 2 * k)
                ok[i] = 1;
        }
    }
    for(int i = 1; i <= n; ++i)
        cout << ok[i];
    cout << '\n';
    for(int i = 1; i <= n; ++i)
        cout << ok2[i];
    return 0;
}


#include <iostream>
using namespace std;
struct player
{
    int id;
    long long int score;
};
bool compareTwoPlayers(struct player a,struct player b)
{
    return (a.score<b.score);
}

int main() {

    int n;
    cin>>n;
    struct player a[n],b[n];
    int ans1[n],ans2[n];
    for(int i=0;i<n;i++)
    {
        cin>>a[i].score;
        cin>>b[i].score;
        a[i].id=i;
        b[i].id=i;
    }
    sort(a,a+n,compareTwoPlayers);
    sort(b,b+n,compareTwoPlayers);
    for(int i=0;i<n;i++)
    {
        if(i<(n/2))
        {
            ans1[a[i].id]=1;
            ans2[b[i].id]=1;
        }
        else
        {
            ans1[a[i].id]=0;
            ans2[b[i].id]=0;
        }
    }
    int i=0,j=0,k=0;
    while(i<n && j<n && k<n)
    {
        if(a[i].score<=b[j].score)
        {
            ans1[a[i].id]=1;
            i++;
        }
        else if(a[i].score>b[j].score)
        {
            ans2[b[j].id]=1;
            j++;
        }
        k++;
    }
    for(int i=0;i<n;i++)
        cout<<ans1[i];
    cout<<"\n";
    for(int i=0;i<n;i++)
        cout<<ans2[i];
    return 0;
}


#include <iostream>
#include <bits/stdc++.h>
using namespace std;
struct player
{
    int id;
    long long int score;
};
bool compareTwoPlayers(struct player a,struct player b)
{
    return (a.score<b.score);
}

int main() {

    int n;
    cin>>n;
    struct player a[n],b[n];
    int ans1[n],ans2[n];
    for(int i=0;i<n;i++)
    {
        cin>>a[i].score;
        cin>>b[i].score;
        a[i].id=i;
        b[i].id=i;
    }
    sort(a,a+n,compareTwoPlayers);
    sort(b,b+n,compareTwoPlayers);
    for(int i=0;i<n;i++)
    {
        if(i<(n/2))
        {
            ans1[a[i].id]=1;
            ans2[b[i].id]=1;
        }
        else
        {
            ans1[a[i].id]=0;
            ans2[b[i].id]=0;
        }
    }
    int i=0,j=0,k=0;
    while(i<n && j<n && k<n)
    {
        if(a[i].score<=b[j].score)
        {
            ans1[a[i].id]=1;
            i++;
        }
        else if(a[i].score>b[j].score)
        {
            ans2[b[j].id]=1;
            j++;
        }
        k++;
    }
    for(int i=0;i<n;i++)
        cout<<ans1[i];
    cout<<"\n";
    for(int i=0;i<n;i++)
        cout<<ans2[i];
    return 0;
}


  // eat sleep code repeat :)
  // vectorTango
  // reapedJuggler

  #include "bits/stdc++.h"

  #define FAST_IO ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)
  #define ll long
  #define all(A) begin(A), end(A)
  #define For(i , n)  for(ll int i = 0; i < n ; i++)
  #define For1(i , n) for(ll int i = n - 1; i >= 0 ; i++)
  #define lld ll
  #define ull unsigned long long
  #define input ll int*a = new ll int[n]
  #define input1 ll int*b = new ll int[n]
  #define vec vector <ll int>
  #define pb push_back
  #define ss second
  #define ff first
  #define maxn 10000123
  #define visp mpp
  #define mod 1000000007
  #define mpp make_pair
  #define finish(x) cout << v << " ";

  using namespace std;

  void start()
  {
    #ifndef ONLINE_JUDGE
    freopen("input.txt" , "r" , stdin) ;
    freopen("output.txt" , "w" , stdout) ;
    #endif
  }

void sober(){
  ll int n;
  cin >> n;
  vec v;
  vec v1;
  ll int a[n];
  ll int b[n];
  ll int temp  , flag = 0;
  For(i , n){
    cin >> temp;
    v.pb(temp);
    a[i] = temp;
    cin >> flag;
    v1.pb(flag);
    b[i] = flag;
  }
  // for(auto i : v)
  //   cout << i << " ";

  sort(all(v));
  sort(all(v1));
  string s = "";
  string s2 = "";
  ll int m = n & 1 ? n / 2 : n / 2 - 1;

  ll int dat = max(v[m] , v1[m]);
  // cout
  if(n >  1){
  For(i , n){
    if(a[i] <= dat)
      s = s + to_string(1);
    else
      s = s + to_string(0);
  }
  For(i , n){
    if(b[i] <= dat)
      s2 = s2 + to_string(1);
    else
      s2 = s2 + to_string(0);
  }
  cout << s << "\n" << s2;
 }
 else{
  For(i , n){
    if(a[i] > b[i]){
      cout << "0\n" << "1";
    }
    else
      cout << "1\n" << "0\n";
  }
 }
}

  signed main(){
    start();
    FAST_IO;
    ll int t = 1;
    // cin >> t;
    while(t--){
       sober();
    }
   }

  //  c0ded by :
  // - - - - - - - - - - - - - - - - - - - - - - s 0 b e r


  // eat sleep code repeat :)
  // vectorTango
  // reapedJuggler

  #include "bits/stdc++.h"

  #define FAST_IO ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)
  #define ll long
  #define all(A) begin(A), end(A)
  #define For(i , n)  for(ll int i = 0; i < n ; i++)
  #define For1(i , n) for(ll int i = n - 1; i >= 0 ; i++)
  #define lld ll
  #define ull unsigned long long
  #define input ll int*a = new ll int[n]
  #define input1 ll int*b = new ll int[n]
  #define vec vector <ll int>
  #define pb push_back
  #define ss second
  #define ff first
  #define maxn 10000123
  #define visp mpp
  #define mod 1000000007
  #define mpp make_pair
  #define finish(x) cout << v << " ";

  using namespace std;

  void start()
  {
    #ifndef ONLINE_JUDGE
    freopen("input.txt" , "r" , stdin) ;
    freopen("output.txt" , "w" , stdout) ;
    #endif
  }

void sober(){
  ll int n;
  cin >> n;
  vec v;
  vec v1;
  ll int a[n];
  ll int b[n];
  ll int temp  , flag = 0;
  For(i , n){
    cin >> temp;
    a[i] = temp;
    cin >> flag;
    b[i] = flag;
  }
  // for(auto i : v)
  //   cout << i << " ";

  sort(all(v));
  sort(all(v1));
  string s = "";
  string s2 = "";
  // ll int m = n & 1 ? n / 2 : n / 2 - 1;
  // vec v2;

  For(i , n){
    if(a[i] < b[n - i - 1] || i + 1<= n / 2){
      cout << "1";
    }
    else
      cout << "0";
  }
  cout << "\n";
  For(i , n){

    if(b[i] < a[n - i - 1] || i + 1 <= n / 2){
      cout << "1";
    }
    else
      cout << "0";
  }

}

  signed main(){
    start();
    FAST_IO;
    ll int t = 1;
    // cin >> t;
    while(t--){
       sober();
    }
   }

  //  c0ded by :
  // - - - - - - - - - - - - - - - - - - - - - - s 0 b e r


  // eat sleep code repeat :)
  // vectorTango
  // reapedJuggler

  #include "bits/stdc++.h"

  #define FAST_IO ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)
  #define ll long
  #define all(A) begin(A), end(A)
  #define For(i , n)  for(ll int i = 0; i < n ; i++)
  #define For1(i , n) for(ll int i = n - 1; i >= 0 ; i++)
  #define lld ll
  #define ull unsigned long long
  #define input ll int*a = new ll int[n]
  #define input1 ll int*b = new ll int[n]
  #define vec vector <ll int>
  #define pb push_back
  #define ss second
  #define ff first
  #define maxn 10000123
  #define visp mpp
  #define mod 1000000007
  #define mpp make_pair
  #define finish(x) cout << v << " ";

  using namespace std;

  void start()
  {
    #ifndef ONLINE_JUDGE
    freopen("input.txt" , "r" , stdin) ;
    freopen("output.txt" , "w" , stdout) ;
    #endif
  }

void sober(){
  ll int n;
  cin >> n;
  vec v;
  vec v1;
  ll int a[n];
  ll int b[n];
  ll int temp  , flag = 0;
  For(i , n){
    cin >> temp;
    v.pb(temp);
    a[i] = temp;
    cin >> flag;
    v1.pb(flag);
    b[i] = flag;
  }
  // for(auto i : v)
  //   cout << i << " ";

  sort(all(v));
  sort(all(v1));
  string s = "";
  string s2 = "";
  ll int m = n & 1 ? n / 2 : n / 2 - 1;

  ll int dat = max(v[m] , v1[m]);
  // cout
  For(i , n){
    if(a[i] <= dat)
      s = s + to_string(1);
    else
      s = s + to_string(0);
  }
  For(i , n){
    if(b[i] <= dat)
      s2 = s2 + to_string(1);
    else
      s2 = s2 + to_string(0);
  }
  cout << s << "\n" << s2;
}

  signed main(){
    start();
    FAST_IO;
    ll int t = 1;
    // cin >> t;
    while(t--){
       sober();
    }
   }

  //  c0ded by :
  // - - - - - - - - - - - - - - - - - - - - - - s 0 b e r


#include <iostream>
using namespace std;

int n, i, x, y, a[100100], b[100100];

int main() {
	cin >> n;
	for (i = 0; i < n; ++i) cin >> a[i] >> b[i], ++(a[x] < b[y] ? x : y);
	for (i = 0; i < n; ++i) cout << (i < max(x, n / 2) ? '1' : '0'); cout << endl;
	for (i = 0; i < n; ++i) cout << (i < max(y, n / 2) ? '1' : '0'); cout << endl;
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ull unsigned long long
ll mod=1e9+7;
#define PI 3.1415926535897932385
#define INF 100000000000000000ll
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);
#include <string>
string char_to_str(char c){string tem(1,c);return tem;}

typedef pair<long long, long long> ii;
#define S second
#define F first
ll max(ll a,ll b){if(a>b){return a;}return b;}
ll min(ll a,ll b){if(a<b){return a;}return b;}
// string to integer stoi() Remember: it takes string not character
// string to long long stoll()
// string.substr(position,length);
// integer to string to_string();

// To compile--> g++ -std=c++0x -o output one.cpp
// To run--> ./output

int main()
{
	fastio;
	// freopen("input.txt","r",stdin);
	// freopen("output.txt","w",stdout);
	ll n;
	cin>>n;
	vector<ii> v1;
	for (int i = 0; i < n; ++i)
	{
		ll n1;
		ll n2;
		cin>>n1>>n2;
		v1.push_back({n1, 1});
		v1.push_back({n2, 2});
	}
	sort(v1.begin(), v1.end());
	string s1="";
	string s2="";
	for (int i = 0; i < n; ++i)
	{
		if(i<(n/2)){
			s1 = s1+"1";
			s2 = s2+"1";
		}
		else{
			s1 = s1+"0";
			s2 = s2+"0";
		}
	}
	ll ind1=0;
	ll ind2=0;
	for (int i = 0; i < n; ++i)
	{
		if(v1[i].S==1){
			s1[ind1]='1';
			ind1++;
		}
		else{
			s2[ind2]='1';
			ind2++;
		}
	}
	cout<<s1<<endl;
	cout<<s2<<endl;

    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){
        cout<<arr[i][0]<<" "<<arr[i][1]<<"\n";
    }*/
    for(i=1;i<=n;++i){
        cin>>a[i]>>b[i];
    }
    long l=1,r=1,cnt=0;
    while(cnt<n){
        if(a[l]<b[r]){
            arr[l][0]=1;
            l++;
            cnt++;
        }
        else{
            arr[r][1]=1;
            r++;
            cnt++;
        }
    }
    for(i=1;2*i<=n;++i){
        cout<<1;
    }
    while(i<=n){
        cout<<arr[i][0];
        ++i;
    }
    cout<<"\n";
    for(i=1;2*i<=n;++i){
        cout<<1;
    }
    while(i<=n){
        cout<<arr[i][1];
        ++i;
    }
    return 0;
}