using System;
using System.Collections;
using System.Collections.Generic;
using System.Text;
using System.Text.RegularExpressions;
using System.Globalization;
using System.Threading;
using System.Linq;

class TEST{
	static void Main(){
		Player[] P=new Player[4];
		for(int i=0;i<4;i++){
			var s=Console.ReadLine().Split(' ');
			P[i]=new Player(int.Parse(s[1]),int.Parse(s[0]));
		}

		int[][] Score=new int[2][];
		for(int i=0;i<2;i++)Score[i]=new int[2];

		int off1=0;
		int off2=0;
		int def1=0;
		int def2=0;

		for(int i=0;i<2;i++){
			if(i==0){off1=P[0].Off;def1=P[1].Def;}
			if(i==1){off1=P[1].Off;def1=P[0].Def;}

			for(int j=0;j<2;j++){
				if(j==0){off2=P[2].Off;def2=P[3].Def;}
				if(j==1){off2=P[3].Off;def2=P[2].Def;}

				if(off1>off2 && def1>def2){Score[i][j]=1;continue;}
				if(off1<off2 && def1<def2){Score[i][j]=2;continue;}
				Score[i][j]=3;
			}
		}
		bool chk1=false;
		for(int i=0;i<2;i++){
			if(Score[i][0]==1 &&Score[i][1]==1)chk1=true;
		}

		bool chk2=true;
		for(int i=0;i<2;i++){
			if(Score[i][0]!=2 &&Score[i][1]!=2)chk2=false;
		}

		Console.WriteLine(chk1?"Team 1":(chk2?"Team 2":"Draw"));

	}
}

struct Player{
	public int Off;
	public int Def;
	public Player(int o,int d){
		Off=o;Def=d;
	}
}


using System;
using System.Collections;
using System.Collections.Generic;
using System.Text;
using System.Text.RegularExpressions;
using System.Globalization;
using System.Threading;
using System.Linq;

class TEST{
	static void Main(){
		Player[] P=new Player[4];
		for(int i=0;i<4;i++){
			var s=Console.ReadLine().Split(' ');
			P[i]=new Player(int.Parse(s[0]),int.Parse(s[1]));
		}

		int[][] Score=new int[2][];
		for(int i=0;i<2;i++)Score[i]=new int[2];

		int off1=0;
		int off2=0;
		int def1=0;
		int def2=0;

		for(int i=0;i<2;i++){
			if(i==0){off1=P[0].Off;def1=P[1].Def;}
			if(i==1){off1=P[1].Off;def1=P[0].Def;}

			for(int j=0;j<2;j++){
				if(j==0){off2=P[2].Off;def2=P[3].Def;}
				if(j==1){off2=P[3].Off;def2=P[2].Def;}

				if(off1>off2 && def1>def2){Score[i][j]=1;continue;}
				if(off1<off2 && def1<def2){Score[i][j]=2;continue;}
				Score[i][j]=3;
			}
		}
		bool chk1=false;
		for(int i=0;i<2;i++){
			if(Score[i][0]==1 &&Score[i][1]==1)chk1=true;
		}

		bool chk2=true;
		for(int i=0;i<2;i++){
			if(Score[i][0]!=2 &&Score[i][1]!=2)chk2=false;
		}

		Console.WriteLine(chk1?"Team 1":(chk2?"Team 2":"Draw"));

	}
}

struct Player{
	public int Off;
	public int Def;
	public Player(int o,int d){
		Off=o;Def=d;
	}
}


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ContestA
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] pass1 = Console.ReadLine().Split(' ');
            string[] pass2 = Console.ReadLine().Split(' ');
            string[] pass3 = Console.ReadLine().Split(' ');
            string[] pass4 = Console.ReadLine().Split(' ');

            int a1 = Convert.ToInt32(pass1[0]);
            int b1 = Convert.ToInt32(pass1[1]);
            int a2 = Convert.ToInt32(pass2[0]);
            int b2 = Convert.ToInt32(pass2[1]);
            int a3 = Convert.ToInt32(pass3[0]);
            int b3 = Convert.ToInt32(pass3[1]);
            int a4 = Convert.ToInt32(pass4[0]);
            int b4 = Convert.ToInt32(pass4[1]);

            // АСАБЫЙ СЛУЧАЙ - ОДИНАКОВО ИГРОКИ
            bool svinka = false;
            if (a1 == a3 || a2 == a4 || b1 == b3 || b2 == b4)
                svinka = true;

            // ВИГРЫШ ВТОРОГА
            if ((a3 > a1 && b4 > b2) || (a4 > a1 && b3 > b2))
                if ((a3 > a2 && b4 > b1) || (a4 > a2 && b3 > b1))
                {
                    Console.WriteLine("Team 2");

                    return;
                }

            // ВИГРЫШ ПЕРВАГО
            if ((a1 > a3 && b2 > b4) && (a2 > a3 && b1 > b4))
                if ((a1 > a4 && b2 > b3) && (a2 > a4 && b1 > b3))
                {
                    if (!svinka)
                        Console.WriteLine("Team 1");
                    else
                        Console.WriteLine("Draw");

                    return;
                }

            Console.WriteLine("Draw");

            return;
        }
    }
}


using System;
using System.Collections.Generic;
using System.Linq;
using System.IO;

namespace Algorithm
{
    class Solver
    {
        Player[] a = new Player[4];

        public void Run()
        {
            for (int i = 0; i < 4; i++)
            {
                string[] tokens = cin.ReadLine().Split();
                int x = int.Parse(tokens[0]);
                int y = int.Parse(tokens[1]);
                a[i] = new Player(x, y);
            }

            if (can_win(a[0].Defence, a[1].Attak, a[2].Defence, a[3].Attak) &&
                can_win(a[0].Defence, a[1].Attak, a[3].Defence, a[2].Attak))
            {
                cout.WriteLine("Team 1");
                return;
            }
            if (can_win(a[1].Defence, a[0].Attak, a[2].Defence, a[3].Attak) &&
                can_win(a[1].Defence, a[0].Attak, a[3].Defence, a[2].Attak))
            {
                cout.WriteLine("Team 1");
                return;
            }

            int cnt = 0;
            if (can_win(a[2].Defence, a[3].Attak, a[0].Defence, a[1].Attak) ||
               can_win(a[3].Defence, a[2].Attak, a[1].Defence, a[0].Attak)) cnt++;
            if (can_win(a[2].Defence, a[3].Attak, a[0].Defence, a[1].Attak) &&
                can_win(a[3].Defence, a[2].Attak, a[1].Defence, a[0].Attak)) cnt++;
            if (cnt == 2)
                cout.WriteLine("Team 2");
            else
                cout.WriteLine("Draw");
        }

        bool can_win(int a, int b, int c, int d)
        {
            if (a > d && b > c) return true;
            return false;
        }

        void Swap(ref int a, ref int b)
        {
            int tmp = a;
            a = b;
            b = tmp;
        }

        public StreamReader cin = null;
        public StreamWriter cout = null;
    }

    class Player
    {
        public Player() { }
        public Player(int _a, int _d)
        {
            this.Attak = _a;
            this.Defence = _d;
        }
        public int Attak;
        public int Defence;
    }

    class Program
    {
        public static void Main(string[] args)
        {
            Solver task = new Solver();
#if DEBUG
            task.cin = new StreamReader("input.txt");
            task.cout = new StreamWriter("output.txt");
#else
            task.cin = new StreamReader(Console.OpenStandardInput());
            task.cout = new StreamWriter(Console.OpenStandardOutput());
#endif
            task.cout.AutoFlush = true;
            task.Run();
        }
    }
}


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ContestA
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] pass1 = Console.ReadLine().Split(' ');
            string[] pass2 = Console.ReadLine().Split(' ');
            string[] pass3 = Console.ReadLine().Split(' ');
            string[] pass4 = Console.ReadLine().Split(' ');

            int a1 = Convert.ToInt32(pass1[0]);
            int b1 = Convert.ToInt32(pass1[1]);
            int a2 = Convert.ToInt32(pass2[0]);
            int b2 = Convert.ToInt32(pass2[1]);
            int a3 = Convert.ToInt32(pass3[0]);
            int b3 = Convert.ToInt32(pass3[1]);
            int a4 = Convert.ToInt32(pass4[0]);
            int b4 = Convert.ToInt32(pass4[1]);

            // АСАБЫЙ СЛУЧАЙ - ОДИНАКОВО ИГРОКИ
            bool svinka = false;
            if (a1 == a3 || a2 == a4 || b1 == b3 || b2 == b4)
                svinka = true;

            // ВИГРЫШ ВТОРОГА
            if ((a3 > a1 && b4 > b2) || (a4 > a1 && b3 > b2))
                if ((a3 > a2 && b4 > b1) || (a4 > a2 && b3 > b1))
                {
                    Console.WriteLine("Team 2");

                    return;
                }

            // ВИГРЫШ ПЕРВАГО
            if ((a1 > a3 && b2 > b4) || (a2 > a3 && b1 > b4))
                if ((a1 > a4 && b2 > b3) || (a2 > a4 && b1 > b3))
                {
                    //if (!svinka)
                        Console.WriteLine("Team 1");
                    //else
                    //    Console.WriteLine("Draw");

                    return;
                }

            Console.WriteLine("Draw");

            return;
        }
    }
}


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

namespace Contest
{
    class Program
    {
        static void Main()
        {
            var s=" ";
            string[] all;
            int[,] a=new int[4,2];
            for (int i = 0; i < 4; i++)
            {
                s=Console.ReadLine();
                all = s.Split(' ');
                a[i, 0] = Convert.ToInt32(all[0]);
                a[i, 1] = Convert.ToInt32(all[1]);
            }
            String win1 = "Team 1";
String win2 = "Team 2";
String draw = "Draw";

int powProtect1 = 0;
int powAttack1 = 0;
int powProtect2 = 0;
int powAttack2 = 0;

int max1=a[0,0]+a[1,1];
if (max1>=a[0,1]+a[1,0])
{powAttack1=a[1,1];
    powProtect1=a[0,0];
}
else
{powAttack1=a[0,1];
    powProtect1=a[1,0];

}
            max1=a[2,0]+a[3,1];
if (max1>=a[2,1]+a[3,0])
{powAttack2=a[3,1];
    powProtect1=a[2,0];
}
else
{powAttack2=a[2,1];
    powProtect2=a[3,0];

}

if((powProtect1 > powProtect2) && (powAttack1 > powAttack2)){
Console.WriteLine(win1);
}else if((powProtect1 < powProtect2) && (powAttack1 < powAttack2)){
Console.WriteLine(win2);
}else{
Console.WriteLine(draw);
}

        }
    }
}


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

namespace Contest
{
    class Program
    {
        static void Main()
        {
            var s=" ";
            string[] all;
            int[,] a=new int[4,2];
            for (int i = 0; i < 4; i++)
            {
                s=Console.ReadLine();
                all = s.Split(' ');
                a[i, 0] = Convert.ToInt32(all[0]);
                a[i, 1] = Convert.ToInt32(all[1]);
            }
            String win1 = "Team 1";
String win2 = "Team 2";
String draw = "Draw";

int powProtect1 = 0;
int powAttack1 = 0;
int powProtect2 = 0;
int powAttack2 = 0;
int powProtect11 = 0;
int powAttack11 = 0;
int powProtect21 = 0;
int powAttack21 = 0;
powAttack1 = a[1, 1];
powProtect1 = a[0, 0];
powAttack11 = a[0, 1];
powProtect11 = a[1, 0];

      powAttack2=a[3,1];
    powProtect2=a[2,0];
    powAttack21 = a[2, 1];
    powProtect21 = a[3, 0];

if (((powProtect11 > powProtect2) && (powAttack11 > powAttack2) && (powProtect11 > powProtect21) && (powAttack11 > powAttack21))||((powProtect1 > powProtect2) && (powAttack1 > powAttack2) && (powProtect1 > powProtect21) && (powAttack1 > powAttack21)))
{
Console.WriteLine(win1);
}else if ((((powProtect1 < powProtect2) && (powAttack1 < powAttack2))||((powProtect1 < powProtect21) && (powAttack1 < powAttack21)))&&(((powProtect11 < powProtect2) && (powAttack11 < powAttack2))||((powProtect11 < powProtect21) && (powAttack11 < powAttack21)))){
Console.WriteLine(win2);
}else{
Console.WriteLine(draw);
}

        }
    }
}


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

namespace Contest
{
    class Program
    {
        static void Main()
        {
            var s=" ";
            string[] all;
            int[,] a=new int[4,2];
            for (int i = 0; i < 4; i++)
            {
                s=Console.ReadLine();
                all = s.Split(' ');
                a[i, 0] = Convert.ToInt32(all[0]);
                a[i, 1] = Convert.ToInt32(all[1]);
            }
            String win1 = "Team 1";
String win2 = "Team 2";
String draw = "Draw";

int powProtect1 = 0;
int powAttack1 = 0;
int powProtect2 = 0;
int powAttack2 = 0;

int max1=a[0,0]+a[1,1];
if (max1>=a[0,1]+a[1,0])
{powAttack1=a[1,1];
    powProtect1=a[0,0];
}
else
{powAttack1=a[0,1];
    powProtect1=a[1,0];

}
            max1=a[2,0]+a[3,1];
            int powAttack21=0;
            int powProtect21 = 0;
if (max1>a[2,1]+a[3,0])
{powAttack2=a[3,1];
    powProtect2=a[2,0];
}
else
    if (max1 < a[2, 1] + a[3, 0])
    {
        powAttack2 = a[2, 1];
        powProtect2 = a[3, 0];

    }
    else
    {
        powAttack2 = a[3, 1];
        powProtect2 = a[2, 0];
        powAttack21 = a[2, 1];
        powProtect21 = a[3, 0];
    }

if((powProtect1 > powProtect2) && (powAttack1 > powAttack2)){
Console.WriteLine(win1);
}else if(((powProtect1 < powProtect2) && (powAttack1 < powAttack2))||((powProtect1 < powProtect21) && (powAttack1 < powAttack21))){
Console.WriteLine(win2);
}else{
Console.WriteLine(draw);
}

        }
    }
}


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

namespace Contest
{
    class Program
    {
        static void Main()
        {
            var s=" ";
            string[] all;
            int[,] a=new int[4,2];
            for (int i = 0; i < 4; i++)
            {
                s=Console.ReadLine();
                all = s.Split(' ');
                a[i, 0] = Convert.ToInt32(all[0]);
                a[i, 1] = Convert.ToInt32(all[1]);
            }
            String win1 = "Team 1";
String win2 = "Team 2";
String draw = "Draw";

int powProtect1 = 0;
int powAttack1 = 0;
int powProtect2 = 0;
int powAttack2 = 0;
int powProtect11 = 0;
int powAttack11 = 0;
int powProtect21 = 0;
int powAttack21 = 0;
powAttack1 = a[1, 1];
powProtect1 = a[0, 0];
powAttack11 = a[0, 1];
powProtect11 = a[1, 0];

      powAttack2=a[3,1];
    powProtect2=a[2,0];
    powAttack21 = a[2, 1];
    powProtect21 = a[3, 0];
if ((((powProtect1 < powProtect2) && (powAttack1 < powAttack2))||((powProtect1 < powProtect21) && (powAttack1 < powAttack21)))&&(((powProtect11 < powProtect2) && (powAttack11 < powAttack2))||((powProtect11 < powProtect21) && (powAttack11 < powAttack21)))){

Console.WriteLine(win2);
}
else if (((powProtect11 > powProtect2) && (powAttack11 > powAttack2) && (powProtect11 > powProtect21) && (powAttack11 > powAttack21)) || ((powProtect1 > powProtect2) && (powAttack1 > powAttack2) && (powProtect1 > powProtect21) && (powAttack1 > powAttack21)))
{  Console.WriteLine(win1);
}else{
Console.WriteLine(draw);
}

        }
    }
}


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ContestA
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] pass1 = Console.ReadLine().Split(' ');
            string[] pass2 = Console.ReadLine().Split(' ');
            string[] pass3 = Console.ReadLine().Split(' ');
            string[] pass4 = Console.ReadLine().Split(' ');

            int a1 = Convert.ToInt32(pass1[0]);
            int b1 = Convert.ToInt32(pass1[1]);
            int a2 = Convert.ToInt32(pass2[0]);
            int b2 = Convert.ToInt32(pass2[1]);
            int a3 = Convert.ToInt32(pass3[0]);
            int b3 = Convert.ToInt32(pass3[1]);
            int a4 = Convert.ToInt32(pass4[0]);
            int b4 = Convert.ToInt32(pass4[1]);

            // АСАБЫЙ СЛУЧАЙ - ОДИНАКОВО ИГРОКИ
            bool svinka = false;
            if (a1 == a3 || a2 == a4 || b1 == b3 || b2 == b4)
                svinka = true;

            // ВИГРЫШ ВТОРОГА
            int can = 0;
            int testA1 = a1, testB1 = b2;

            if ((a3 > testA1 && b4 > testB1) || (a4 > testA1 && b3 > testB1))
            {
                can++;
                // Console.WriteLine("Team 2");
                // return;
            }

            testA1 = a2; testB1 = b1;

            if ((a3 > testA1 && b4 > testB1) || (a4 > testA1 && b3 > testB1))
            {
                can++;
                // Console.WriteLine("Team 2");
                // return;
            }

            // ВИГРЫШ ПЕРВАГО
            int can2 = 0;

            if ((a1 > a3 && b2 > b4) || (a2 > a3 && b1 > b4))
                can2++;

            if ((a1 > a4 && b2 > b3) || (a2 > a4 && b1 > b3))
                can2++;

            if (can == 2)
                Console.WriteLine("Team 2");
            else if (can2 == 2)
            {
                if(!svinka)
                    Console.WriteLine("Team 1");
                else
                    Console.WriteLine("Draw");
            }
            else
                Console.WriteLine("Draw");
        }
    }
}


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

namespace Contest
{
    class Program
    {
        static void Main()
        {
            var s=" ";
            string[] all;
            int[,] a=new int[4,2];
            for (int i = 0; i < 4; i++)
            {
                s=Console.ReadLine();
                all = s.Split(' ');
                a[i, 0] = Convert.ToInt32(all[0]);
                a[i, 1] = Convert.ToInt32(all[1]);
            }
            String win1 = "Team 1";
String win2 = "Team 2";
String draw = "Draw";

int powProtect1 = 0;
int powAttack1 = 0;
int powProtect2 = 0;
int powAttack2 = 0;
int powProtect11 = 0;
int powAttack11 = 0;
int powProtect21 = 0;
int powAttack21 = 0;
powAttack1 = a[1, 1];
powProtect1 = a[0, 0];
powAttack11 = a[0, 1];
powProtect11 = a[1, 0];

      powAttack2=a[3,1];
    powProtect2=a[2,0];
    powAttack21 = a[2, 1];
    powProtect21 = a[3, 0];

if (((powProtect11 > powProtect2) && (powAttack11 > powAttack2) && (powProtect11 > powProtect21) && (powAttack11 > powAttack21))||((powProtect1 > powProtect2) && (powAttack1 > powAttack2) && (powProtect1 > powProtect21) && (powAttack1 > powAttack21)))
{
Console.WriteLine(win1);
}else if ((((powProtect1 < powProtect2) && (powAttack1 < powAttack2))||((powProtect1 < powProtect21) && (powAttack1 < powAttack21)))&&(((powProtect1 < powProtect2) && (powAttack1 < powAttack2))||((powProtect1 < powProtect21) && (powAttack1 < powAttack21)))){
Console.WriteLine(win2);
}else{
Console.WriteLine(draw);
}

        }
    }
}


// Submitted by Silithus @ Macau
using System;
using System.IO;
using System.Collections.Generic;
using CCF_XOI;

namespace RCC2014
{
	class QR_C
	{
		private int beat(int a_atk, int a_def, int b_atk, int b_def)
		{
			if (a_atk > b_atk && a_def > b_def) return 1;
			if (b_atk > a_atk && b_def > a_def) return -1;
			return 0;
		}

		public void Solve(XOI xoi)
		{
			int i, j, res, ans;
			int[,] team;
			string[] ans_words = { "Team 2", "Draw", "Team 1" };

			team = new int[4, 2];
			for (i = 0; i < 4; i++)
				for (j = 0; j < 2; j++)
					team[i, j] = xoi.ReadInt();

			for (i = 0, ans = -1999; i <= 1; i++)
			{
				for (j = 2, res = 1999; j <= 3; j++)
					res = Math.Min(res, beat(team[i, 1], team[1 - i, 0], team[j, 1], team[5 - j, 0]));
				ans = Math.Max(ans, res);
			}

			xoi.o.WriteLine(ans_words[ans + 1]);
		}
	}

	class RCC2014_QR
	{
		static void Main(string[] args)
		{
			XOI xoi = new XOI();
			(new QR_C()).Solve(xoi);
		}
	}
}

namespace CCF_XOI
{
	class XOI
	{
		protected StreamReader sr;
		public StreamWriter o;
		protected Queue<string> buf = new Queue<string>();
		public bool EOF = false;

		public XOI()
		{
			this.sr = new StreamReader(Console.OpenStandardInput());
			this.o = new StreamWriter(Console.OpenStandardOutput());
			this.o.AutoFlush = true;
		}

		public XOI(string in_path, string out_path)
		{
			this.sr = new StreamReader(in_path);
			this.o = new StreamWriter(out_path);
			this.o.AutoFlush = true;
		}

		public int ReadInt()
		{
			string s = this.GetNext();
			if (s == null) return -1;
			else return Int32.Parse(s);
		}

		public long ReadLong()
		{
			string s = this.GetNext();
			if (s == null) return -1;
			else return Int64.Parse(s);
		}

		public double ReadDouble()
		{
			string s = this.GetNext();
			if (s == null) return -1;
			else return Double.Parse(s);
		}

		public string ReadString()
		{
			string s = this.GetNext();
			return (s == null ? null : s);
		}

		public string ReadLine()
		{	// I will ignore current buffer and read a new line
			string s = "";
			while (s == "" && !this.EOF)
			{
				s = sr.ReadLine();
				this.EOF = (s == null);
			}
			return (this.EOF ? null : s);
		}

		protected string GetNext()
		{
			if (buf.Count == 0)
			{
				while (buf.Count == 0 && !this.EOF)
				{
					string s = sr.ReadLine();
					if (s == null)
						this.EOF = true;
					else
						foreach (string ss in s.Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries))
							buf.Enqueue(ss);
				}
			}

			return (this.EOF ? null : buf.Dequeue());
		}
	}
}


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

namespace Contest
{
    class Program
    {
        static void Main()
        {
            var s=" ";
            string[] all;
            int[,] a=new int[4,2];
            for (int i = 0; i < 4; i++)
            {
                s=Console.ReadLine();
                all = s.Split(' ');
                a[i, 0] = Convert.ToInt32(all[0]);
                a[i, 1] = Convert.ToInt32(all[1]);
            }
            String win1 = "Team 1";
String win2 = "Team 2";
String draw = "Draw";

int powProtect1 = 0;
int powAttack1 = 0;
int powProtect2 = 0;
int powAttack2 = 0;
int powProtect11 = 0;
int powAttack11 = 0;
int powProtect21 = 0;
int powAttack21 = 0;
powAttack1 = a[1, 1];
powProtect1 = a[0, 0];
powAttack11 = a[0, 1];
powProtect11 = a[1, 0];

      powAttack2=a[3,1];
    powProtect2=a[2,0];
    powAttack21 = a[2, 1];
    powProtect21 = a[3, 0];
    if ((((powProtect1 < powAttack2) && (powAttack1 < powProtect2)) || ((powProtect1 < powAttack21) && (powAttack1 < powProtect21))) && (((powProtect11 < powAttack2) && (powAttack11 < powProtect2)) || ((powProtect11 < powAttack21) && (powAttack11 < powProtect21))))
    {

Console.WriteLine(win2);
}
    else if (((powProtect11 > powAttack2) && (powAttack11 > powProtect2) && (powProtect11 > powProtect21) && (powAttack11 > powProtect21)) || ((powProtect1 > powAttack2) && (powAttack1 > powProtect2) && (powProtect1 > powAttack21) && (powAttack1 > powProtect21)))
{  Console.WriteLine(win1);
}else{
Console.WriteLine(draw);
}

        }
    }
}


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace C.Kicker
{
    class Program
    {
        static void Main(string[] args)
        {
            int[] D = new int[8];
            for (int i = 0; i < 8; i+=2)
            {
                string[] str = Console.ReadLine().Split(' ');
                D[i] = int.Parse(str[0]);
                D[i + 1] = int.Parse(str[1]);
            }
            int R11 = check(D[0], D[3], D[4], D[7]), R12 = check(D[0], D[3], D[6], D[5]);
            if (R11 == 1 && R12 == 1) Console.WriteLine("Team 1"); else {
                int R21 = check(D[2], D[1], D[4], D[7]), R22 = check(D[2], D[1], D[6], D[5]);
                if (R21 == 1 && R22 == 1) Console.WriteLine("Team 1");
                else if ((R11 == 2 || R12 == 2) && (R21 == 2 || R22 == 2)) Console.WriteLine("Team 2");
                else Console.WriteLine("Draw");
            }
            Console.ReadKey();
        }
        public static int check(int team1_1, int team1_2, int team2_1,int team2_2)
        {
            if (team1_1 > team2_2 && team1_2 > team2_1)  return 1;
            if (team1_1 < team2_2 && team1_2 < team2_1) return 2;
            return 0;
        }
    }
}


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

namespace ConsoleApp {

    class Program {

        static void Main(string[] args) {

            string number = Console.ReadLine().Trim();
            int step = -1;
            MinStep(0, 0, number, Fill(new int[number.Length], 1), ref step);

            Console.WriteLine(step);
        }

        public static bool IsSquare(string number) {

            return Math.Pow((int)Math.Sqrt(int.Parse(number)), 2) == int.Parse(number);
        }

        public static int[] Fill(int[] array, int value) {

            for(int i = 0; i < array.Length; i++) {

                array[i] = value;
            }

            return array;
        }

        public static string GetNumber(string number, int[] usage) {

            var result = new StringBuilder();

            for(int i = 0; i < usage.Length; i++) {

                if(usage[i] == 1) {

                    result.Append(number[i]);
                }
            }

            return result.ToString();
        }

        public static void MinStep(int counter, int total, string number, int[] usage, ref int min) {

            string newNum = GetNumber(number, usage);

            if(newNum != string.Empty && newNum[0] != '0' && IsSquare(GetNumber(number, usage))) {

                min = min == -1 ? total : Math.Min(min, total);

                return;
            }

            if(counter == number.Length) {

                return;
            }

            int[] newUsage = usage.ToList().ToArray();
            newUsage[counter] = 0;
            MinStep(counter + 1, total + 1, number, newUsage, ref min);
            MinStep(counter + 1, total, number, usage, ref min);
        }
    }
}


using System;
using System.Collections;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Numerics;
using System.Text;
using System.Threading;

public class CodeForces87
{
#if TEST
    // To set this go to Project -> Properties -> Build -> General -> Conditional compilation symbols: -> enter 'TEST' into text box.
    const bool testing = false;
#else
const bool testing = false;
#endif

    private static int Next()
    {
        int c;
        int res = 0;
        do
        {
            c = reader.Read();
            if (c == -1)
                return res;
        } while (c < '0' || c > '9');
        res = c - '0';
        while (true)
        {
            c = reader.Read();
            if (c < '0' || c > '9')
                return res;
            res *= 10;
            res += c - '0';
        }
    }
    private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024 * 10), Encoding.ASCII, false, 1024 * 10);
    private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024 * 10), Encoding.ASCII, 1024 * 10);

    static void program(TextReader input)
     {
        //reader.ReadLine();
        //var data = reader.ReadLine().TrimEnd().Split(' ').Select(long.Parse).ToList();

        var n = long.Parse(reader.ReadLine());
        var ns = n.ToString();
        var result = int.MaxValue;
        for (var i = 0; i < Math.Pow(2, 10);i++){
            var s = Convert.ToString(i, 2).PadLeft(10).Substring(0, ns.Length);
            var news = new StringBuilder();
            for (var j = 0; j < s.Length;j++){
                if(s[j] == '1'){
                    news.Append(ns[j]);
                }
            }

            var res = news.ToString();
            if(res.Length > 0 && res[0] != '0'){
                var pos = int.Parse(res);
                if(Math.Sqrt(pos) % 1 == 0){
                    result = Math.Min(result, ns.Length - pos.ToString().Length);
                }
            }
        }
        Console.WriteLine(result == int.MaxValue ? -1 : result);
    }

    public static void Main(string[] args)
    {
        CultureInfo nonInvariantCulture = new CultureInfo("en-US");
        Thread.CurrentThread.CurrentCulture = nonInvariantCulture;
        if (!testing)
        { // set testing to false when submiting to codeforces
            program(Console.In); // write your program in 'program' function (its your new main !)
            return;
        }

        Console.WriteLine("Test Case(1) => expected :");
        Console.WriteLine("3\n2\n4\n");
        Console.WriteLine("Test Case(1) => found    :");
        program(new StringReader("4 3\n2\n3\n4\n"));
        Console.WriteLine();

        Console.WriteLine("Test Case(2) => expected :");
        Console.WriteLine("13\n3\n8\n9\n");
        Console.WriteLine("Test Case(2) => found    :");
        program(new StringReader("13 4\n10\n5\n4\n8\n"));
        Console.WriteLine();

    }
}


using System;
using System.Linq;

namespace test
{
	class Test
	{
	    static int min;
	    static int n;

	    static int IsSqrt(String str)
	    {
	        //Console.WriteLine(str.Length);
	        if(Math.Sqrt(int.Parse(str)) % 1 == 0 && str[0] != '0')
	        {
	            return n - str.Length;
	        }
	        else
	        {
	            if(str.Length > 1)
	            {
    	            int minl = 11;
    	            for(int i = 0; i < str.Length; i++)
    	            {
    	                String nextstr = str.Remove(i, 1);
    	                int res = IsSqrt(nextstr);
    	                if(res < minl)
    	                {
    	                    minl = res;
    	                }
    	            }
    	            return minl;
	            }
	            else
	            {
	                return 11;
	            }
	        }
	    }

		static void Main(string[] args)
		{
		    //in
		    String num = Console.ReadLine();

		    //comp
		    min = 0;
		    n = num.Length;

		    min = IsSqrt(num);
		    if(min == 11)
		        min = -1;

		    //out
			Console.WriteLine(min);
		}
	}
}


using System;
using System.IO;
using System.Collections.Generic;
using System.Linq;

namespace CSharpParser
{
    public class Solution : SolutionBase
    {
        protected override void Solve()
        {
            string s;
            Next(out s);
            var ans = s.Length;
            for (var i = 1; i < 1 << s.Length; i++)
            {
                var cur = "";
                for (var j = 0; j < s.Length; j++)
                    if ((i >> j & 1) != 0)
                        cur += s[j];
                if (cur[0] == '0')
                    continue;
                var x = int.Parse(cur);
                var q = (int)Math.Sqrt(x);
                while (q * q < x) ++q;
                while (q * q > x) --q;
                if (q * q == x)
                    ans = Math.Min(ans, s.Length - cur.Length);
            }
            PrintLine(ans == s.Length ? -1 : ans);
        }
    }

	public static class Algorithm
	{
		private static readonly Random Rnd = new Random();

		public static void Swap<T>(ref T a, ref T b)
		{
			var temp = a;
			a = b;
			b = temp;
		}

		public static T Max<T>(params T[] a)
		{
			var ans = a[0];
			var comp = Comparer<T>.Default;
			for (var i = 1; i < a.Length; i++) ans = comp.Compare(ans, a[i]) >= 0 ? ans : a[i];
			return ans;
		}

		public static T Min<T>(params T[] a)
		{
			var ans = a[0];
			var comp = Comparer<T>.Default;
			for (var i = 1; i < a.Length; i++) ans = comp.Compare(ans, a[i]) <= 0 ? ans : a[i];
			return ans;
		}

		public static void RandomShuffle<T>(IList<T> a, int index, int length)
		{
			if (index < 0 || length < 0) throw new ArgumentOutOfRangeException();
			var last = index + length;
			if (last > a.Count) throw new ArgumentException();
			for (var i = index + 1; i < last; i++)
			{
				var j = Rnd.Next(index, i + 1);
				var t = a[i];
				a[i] = a[j];
				a[j] = t;
			}
		}

		public static void RandomShuffle<T>(IList<T> a)
		{
			RandomShuffle(a, 0, a.Count);
		}

		public static bool NextPermutation<T>(IList<T> a, int index, int length, Comparison<T> compare = null)
		{
			compare = compare ?? Comparer<T>.Default.Compare;
			if (index < 0 || length < 0) throw new ArgumentOutOfRangeException();
			var last = index + length;
			if (last > a.Count) throw new ArgumentException();
			for (var i = last - 1; i > index; i--)
				if (compare(a[i], a[i - 1]) > 0)
				{
					var j = i + 1;
					for (; j < last; j++) if (compare(a[j], a[i - 1]) <= 0) break;
					var t = a[i - 1];
					a[i - 1] = a[j - 1];
					a[j - 1] = t;
					for (; i < last - 1; i++, last--)
					{
						t = a[i];
						a[i] = a[last - 1];
						a[last - 1] = t;
					}
					return true;
				}
			for (var i = index; i < last - 1; i++, last--)
			{
				var t = a[i];
				a[i] = a[last - 1];
				a[last - 1] = t;
			}
			return false;
		}

		public static bool NextPermutation<T>(IList<T> a, Comparison<T> compare = null)
		{
			return NextPermutation(a, 0, a.Count, compare);
		}

		public static bool PrevPermutation<T>(IList<T> a, int index, int length, Comparison<T> compare = null)
		{
			compare = compare ?? Comparer<T>.Default.Compare;
			if (index < 0 || length < 0) throw new ArgumentOutOfRangeException();
			var last = index + length;
			if (last > a.Count) throw new ArgumentException();
			for (var i = last - 1; i > index; i--)
				if (compare(a[i], a[i - 1]) < 0)
				{
					var j = i + 1;
					for (; j < last; j++) if (compare(a[j], a[i - 1]) >= 0) break;
					var t = a[i - 1];
					a[i - 1] = a[j - 1];
					a[j - 1] = t;
					for (; i < last - 1; i++, last--)
					{
						t = a[i];
						a[i] = a[last - 1];
						a[last - 1] = t;
					}
					return true;
				}
			for (var i = index; i < last - 1; i++, last--)
			{
				var t = a[i];
				a[i] = a[last - 1];
				a[last - 1] = t;
			}
			return false;
		}

		public static bool PrevPermutation<T>(IList<T> a, Comparison<T> compare = null)
		{
			return PrevPermutation(a, 0, a.Count, compare);
		}

		public static int LowerBound<T>(IList<T> a, int index, int length, T value, Comparison<T> compare = null)
		{
			compare = compare ?? Comparer<T>.Default.Compare;
			if (index < 0 || length < 0) throw new ArgumentOutOfRangeException();
			if (index + length > a.Count) throw new ArgumentException();
			var ans = index;
			var last = index + length;
			var p2 = 1;
			while (p2 <= length) p2 *= 2;
			for (p2 /= 2; p2 > 0; p2 /= 2) if (ans + p2 <= last && compare(a[ans + p2 - 1], value) < 0) ans += p2;
			return ans;
		}

		public static int LowerBound<T>(IList<T> a, T value, Comparison<T> compare = null)
		{
			return LowerBound(a, 0, a.Count, value, compare);
		}

		public static int UpperBound<T>(IList<T> a, int index, int length, T value, Comparison<T> compare = null)
		{
			compare = compare ?? Comparer<T>.Default.Compare;
			if (index < 0 || length < 0) throw new ArgumentOutOfRangeException();
			if (index + length > a.Count) throw new ArgumentException();
			var ans = index;
			var last = index + length;
			var p2 = 1;
			while (p2 <= length) p2 *= 2;
			for (p2 /= 2; p2 > 0; p2 /= 2) if (ans + p2 <= last && compare(a[ans + p2 - 1], value) <= 0) ans += p2;
			return ans;
		}

		public static int UpperBound<T>(IList<T> a, T value, Comparison<T> compare = null)
		{
			return UpperBound(a, 0, a.Count, value, compare);
		}

		public static void Fill<T>(this IList<T> array, T value) where T : struct
		{
			for (var i = 0; i < array.Count; i++)
				array[i] = value;
		}

		public static void Fill<T>(this IList<T> array, Func<int, T> func)
		{
			for (var i = 0; i < array.Count; i++)
				array[i] = func(i);
		}
	}

	public class InStream : IDisposable
	{
		protected readonly TextReader InputStream;
		private string[] _tokens;
		private int _pointer;

		private InStream(TextReader inputStream)
		{
			InputStream = inputStream;
		}

		public static InStream FromString(string str)
		{
			return new InStream(new StringReader(str));
		}

		public static InStream FromFile(string str)
		{
			return new InStream(new StreamReader(str));
		}

		public static InStream FromConsole()
		{
			return new InStream(Console.In);
		}

		public string NextLine()
		{
			try
			{
				return InputStream.ReadLine();
			}
			catch (Exception)
			{
				return null;
			}
		}

		private string NextString()
		{
			try
			{
				while (_tokens == null || _pointer >= _tokens.Length)
				{
					_tokens = NextLine().Split(new[] { ' ', '\t' }, StringSplitOptions.RemoveEmptyEntries);
					_pointer = 0;
				}
				return _tokens[_pointer++];
			}
			catch (Exception)
			{
				return null;
			}
		}

		public bool Next<T>(out T ans)
		{
			var str = NextString();
			if (str == null)
			{
				ans = default(T);
				return false;
			}
			ans = (T)Convert.ChangeType(str, typeof(T));
			return true;
		}

		public T[] NextArray<T>(int length)
		{
			var array = new T[length];
			for (var i = 0; i < length; i++)
				if (!Next(out array[i]))
					return null;
			return array;
		}

		public T[,] NextArray<T>(int length, int width)
		{
			var array = new T[length, width];
			for (var i = 0; i < length; i++)
				for (var j = 0; j < width; j++)
					if (!Next(out array[i, j]))
						return null;
			return array;
		}

		public void Dispose()
		{
			InputStream.Close();
		}
	}

	public class OutStream : IDisposable
	{
		protected readonly TextWriter OutputStream;

		private OutStream(TextWriter outputStream)
		{
			OutputStream = outputStream;
		}

		public static OutStream FromString(System.Text.StringBuilder strB)
		{
			return new OutStream(new StringWriter(strB));
		}

		public static OutStream FromFile(string str)
		{
			return new OutStream(new StreamWriter(str));
		}

		public static OutStream FromConsole()
		{
			return new OutStream(Console.Out);
		}

		public void Print(string format, params object[] args)
		{
			OutputStream.Write(format, args);
		}

		public void PrintLine(string format, params object[] args)
		{
			Print(format, args);
			OutputStream.WriteLine();
		}

		public void PrintLine()
		{
			OutputStream.WriteLine();
		}

		public void Print<T>(T o)
		{
			OutputStream.Write(o);
		}

		public void PrintLine<T>(T o)
		{
			OutputStream.WriteLine(o);
		}

		public void PrintArray<T>(IList<T> a, string between = " ", string after = "\n", bool printCount = false)
		{
			if (printCount)
				PrintLine(a.Count);
			for (var i = 0; i < a.Count; i++)
				Print("{0}{1}", a[i], i == a.Count - 1 ? after : between);
		}

		public void Dispose()
		{
			OutputStream.Close();
		}
	}

	public abstract class SolutionBase : IDisposable
	{
		private InStream _in;
		private OutStream _out;

		protected SolutionBase()
		{
			//System.Threading.Thread.CurrentThread.CurrentCulture = System.Globalization.CultureInfo.InvariantCulture;
			_in = InStream.FromConsole();
			_out = OutStream.FromConsole();
		}

		protected string NextLine()
		{
			return _in.NextLine();
		}

		protected bool Next<T>(out T ans)
		{
			return _in.Next(out ans);
		}

		protected T[] NextArray<T>(int length)
		{
			return _in.NextArray<T>(length);
		}

		protected T[,] NextArray<T>(int length, int width)
		{
			return _in.NextArray<T>(length, width);
		}

		protected void PrintArray<T>(IList<T> a, string between = " ", string after = "\n", bool printCount = false)
		{
			_out.PrintArray(a, between, after, printCount);
		}

		public void Print(string format, params object[] args)
		{
			_out.Print(format, args);
		}

		public void PrintLine(string format, params object[] args)
		{
			_out.PrintLine(format, args);
		}

		public void PrintLine()
		{
			_out.PrintLine();
		}

		public void Print<T>(T o)
		{
			_out.Print(o);
		}

		public void PrintLine<T>(T o)
		{
			_out.PrintLine(o);
		}

		public void Dispose()
		{
			_in.Dispose();
			_out.Dispose();
		}

		public void Freopen(string path, FileAccess access)
		{
			switch (access)
			{
				case FileAccess.Read:
					_in.Dispose();
					_in = InStream.FromFile(path);
					break;
				case FileAccess.Write:
					_out.Dispose();
					_out = OutStream.FromFile(path);
					break;
			}
		}

		protected abstract void Solve();

		public static void Main()
		{
			using (var p = new Solution()) p.Solve();
		}
	}
}


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

namespace SedlajKvadrat
{
    class Program
    {
       static int minMoves;

       private static void GetSquare(int n,int moves)
       {
           if (Math.Pow(Math.Floor(Math.Sqrt(n)),2)==n)
           {
               if (moves < minMoves) minMoves = moves;
               return;
           }

           if (n < 10) return;

           string s = n.ToString();
           for (int i=0;i<s.Length;i++)
           {
               if (i!=0 ||  s[i+1]!='0')
               {
                   string p = s.Remove(i, 1);
                   GetSquare(Convert.ToInt32(p), moves + 1);
               }
           }
       }

       static void Main(string[] args)
       {
           int n = int.Parse(Console.ReadLine());
           minMoves = 11;
           GetSquare(n, 0);

           if (minMoves<11)
               Console.Write(minMoves);
           else
               Console.Write(-1);

       }
    }
}


using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Text;

class Program
{
    private static bool IsSquare(int n)
    {
        var root = (int)(Math.Sqrt(n));
        if (root * root == n) return true;
        root++;
        if (root * root == n) return true;

        return false;
    }

    private static int[] dp = new int[1000000];
    private static int Solve(int n)
    {
        if (IsSquare(n)) return 0;
        if (n < dp.Length && dp[n] > 0) return dp[n];
        var ans = 10000;
        var s = n.ToString();
        if (s.Length == 1) return 100;

        int startPos = 0;
        if (s.Length > 1 && s[1] == '0') startPos = 1;

        for (int i = startPos; i < s.Length; i++)
        {
            var ss = s.Remove(i, 1);
            ans = Math.Min(ans, 1 + Solve(int.Parse(ss)));
        }

        if (n < dp.Length) dp[n] = ans;

        return ans;
    }

    private static void Main(string[] args)
    {/*
        for (int i = 1; i < 1000000; i++)
            Solve(i);
        */
        var n = RI();
        var ans = Solve(n);
        if (ans >= 100) ans = -1;
        Console.WriteLine(ans);

        //var n = RI();
        //var log = (n.ToString().Length);
    }

    private const int Mod = 1000000000 + 7;

    #region Data Read

    private static int GCD(int a, int b)
    {
        if (a % b == 0) return b;
        return GCD(b, a % b);
    }

    private static List<int>[] ReadTree(int n)
    {
        return ReadGraph(n, n - 1);
    }

    private static List<int>[] ReadGraph(int n, int m)
    {
        List<int>[] g = new List<int>[n];
        for (int i = 0; i < g.Length; i++) g[i] = new List<int>();
        for (int i = 0; i < m; i++)
        {
            int a = RI() - 1;
            int b = RI() - 1;

            g[a].Add(b);
            g[b].Add(a);
        }

        return g;
    }

    private static int[,] ReadGraphAsMatrix(int n, int m)
    {
        int[,] matrix = new int[n + 1, n + 1];
        for (int i = 0; i < m; i++)
        {
            int a = RI();
            int b = RI();
            matrix[a, b] = matrix[b, a] = 1;
        }

        return matrix;
    }

    private static void Sort(ref int a, ref int b)
    {
        if (a > b) Swap(ref a, ref b);
    }

    private static void Swap(ref int a, ref int b)
    {
        int tmp = a;
        a = b;
        b = tmp;
    }

    private const int BufferSize = 1 << 16;
    private static StreamReader consoleReader;
    private static MemoryStream testData;

    private static int RI()
    {
        int ans = 0;
        int mul = 1;
        do
        {
            ans = consoleReader.Read();
            if (ans == -1)
                return 0;
            if (ans == '-') mul = -1;
        } while (ans < '0' || ans > '9');

        ans -= '0';
        while (true)
        {
            int chr = consoleReader.Read();
            if (chr < '0' || chr > '9')
                return ans * mul;
            ans = ans * 10 + chr - '0';
        }
    }

    private static ulong RUL()
    {
        ulong ans = 0;
        int chr;
        do
        {
            chr = consoleReader.Read();
            if (chr == -1)
                return 0;
        } while (chr < '0' || chr > '9');

        ans = (uint)(chr - '0');
        while (true)
        {
            chr = consoleReader.Read();
            if (chr < '0' || chr > '9')
                return ans;
            ans = ans * 10 + (uint)(chr - '0');
        }
    }

    private static long RL()
    {
        long ans = 0;
        int mul = 1;
        do
        {
            ans = consoleReader.Read();
            if (ans == -1)
                return 0;
            if (ans == '-') mul = -1;
        } while (ans < '0' || ans > '9');

        ans -= '0';
        while (true)
        {
            int chr = consoleReader.Read();
            if (chr < '0' || chr > '9')
                return ans * mul;
            ans = ans * 10 + chr - '0';
        }
    }

    private static int[] RIA(int n)
    {
        int[] ans = new int[n];
        for (int i = 0; i < n; i++)
            ans[i] = RI();
        return ans;
    }

    private static long[] RLA(int n)
    {
        long[] ans = new long[n];
        for (int i = 0; i < n; i++)
            ans[i] = RL();
        return ans;
    }

    private static char[] ReadWord()
    {
        int ans;

        do
        {
            ans = consoleReader.Read();
        } while (!((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z') || (ans == '*')));

        List<char> s = new List<char>();
        do
        {
            s.Add((char)ans);
            ans = consoleReader.Read();
        } while ((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z') || (ans == '*'));

        return s.ToArray();
    }

    private static char[] ReadString(int n)
    {
        int ans;

        do
        {
            ans = consoleReader.Read();
        } while (!((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z')));

        char[] s = new char[n];
        int pos = 0;
        do
        {
            s[pos++] = (char)ans;
            if (pos == n) break;
            ans = consoleReader.Read();
        } while ((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z'));

        return s;
    }

    private static char[] ReadStringLine()
    {
        int ans;

        do
        {
            ans = consoleReader.Read();
        } while (ans == 10 || ans == 13);

        List<char> s = new List<char>();

        do
        {
            s.Add((char)ans);
            ans = consoleReader.Read();
        } while (ans != 10 && ans != 13 && ans != -1);

        return s.ToArray();
    }

    private static char ReadLetter()
    {
        while (true)
        {
            int ans = consoleReader.Read();
            if ((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z'))
                return (char)ans;
        }
    }
    private static char ReadNonLetter()
    {
        while (true)
        {
            int ans = consoleReader.Read();
            if (!((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z')))
                return (char)ans;
        }
    }

    private static char ReadAnyOf(IEnumerable<char> allowed)
    {
        while (true)
        {
            char ans = (char)consoleReader.Read();
            if (allowed.Contains(ans))
                return ans;
        }
    }

    private static char ReadDigit()
    {
        while (true)
        {
            int ans = consoleReader.Read();
            if (ans >= '0' && ans <= '9')
                return (char)ans;
        }
    }

    private static int ReadDigitInt()
    {
        return ReadDigit() - (int)'0';
    }

    private static char ReadAnyChar()
    {
        return (char)consoleReader.Read();
    }

    private static string DoubleToString(double x)
    {
        return x.ToString(CultureInfo.InvariantCulture);
    }

    private static double DoubleFromString(string x)
    {
        return double.Parse(x, CultureInfo.InvariantCulture);
    }

    static Program()
    {
        //Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;
        consoleReader = new StreamReader(Console.OpenStandardInput(BufferSize), Encoding.ASCII, false, BufferSize);
    }

    private static void PushTestData(StringBuilder sb)
    {
        PushTestData(sb.ToString());
    }
    private static void PushTestData(string data)
    {
#if TOLYAN_TEST
        if (testData == null)
        {
            testData = new MemoryStream();
            consoleReader = new StreamReader(testData);
        }

        var pos = testData.Position;
        var bytes = Encoding.UTF8.GetBytes(data);
        testData.Write(bytes, 0, bytes.Length);
        testData.Flush();
        testData.Position = pos;
#endif
    }
    #endregion
}


using System;

namespace CSharp
{
    class _962C
    {
        public static void Main()
        {
            string strN = Console.ReadLine();
            int n = int.Parse(strN);

            int result = -1;

            for (int i = 1; i <= n / i; i++)
            {
                string strI2 = (i * i).ToString();
                bool possible = true;

                for (int indN = 0, indI2 = 0; indI2 < strI2.Length; indI2++, indN++)
                {
                    while (indN < strN.Length && strN[indN] != strI2[indI2])
                    {
                        indN++;
                    }

                    if (indN >= strN.Length)
                    {
                        possible = false;
                        break;
                    }
                }

                if (possible)
                {
                    result = strN.Length - strI2.Length;
                }
            }

            Console.WriteLine(result);
        }
    }
}


using System;
using System.Collections.Generic;
using System.Linq;
using System.IO;
using System.Threading;
using System.Runtime.CompilerServices;
using System.Text;
using System.Diagnostics;
using System.Numerics;
using static System.Console;
using static System.Convert;
using static System.Math;
using static Template;
using Pi = Pair<int, int>;

class Solver
{
    public Scanner sc;
    public void Solve()
    {
        var N = sc.Str.ToCharArray();var res = int.MaxValue;
        for (int i = 0; i < (1 << N.Length); i++)
        {
            var s = new List<char>();
            var ct = 0;
            for (int j = 0; j < N.Length; j++)
            {
                if ((1 & i >> j) == 0) { ct++; continue; }
                s.Add(N[j]);
            }
            if (s.Count==0||s[0] == '0') continue;
            var n = long.Parse(new string(s.ToArray()));
            long l = -1, r = 1000000007;
            while (r - l > 1)
            {
                var m = (r + l) / 2;
                if (m * m >= n) r = m;
                else l = m;
            }
            if (r * r == n) { chmin(ref res, ct); }
        }
        if (res == int.MaxValue) Fail(-1);
        Console.WriteLine(res);
    }
}

#region Template
public static class Template
{
    static void Main(string[] args)
    {
        Console.SetOut(new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false });
        var sol = new Solver() { sc = new Scanner() };
        //var th = new Thread(sol.Solve, 1 << 26);th.Start();th.Join();
        sol.Solve();
        Console.Out.Flush();
    }
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    public static bool chmin<T>(ref T a, T b) where T : IComparable<T> { if (a.CompareTo(b) > 0) { a = b; return true; } return false; }
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    public static bool chmax<T>(ref T a, T b) where T : IComparable<T> { if (a.CompareTo(b) < 0) { a = b; return true; } return false; }
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    public static void swap<T>(ref T a, ref T b) { var t = b; b = a; a = t; }
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    public static void swap<T>(this IList<T> A, int i, int j) { var t = A[i]; A[i] = A[j]; A[j] = t; }
    public static T[] Create<T>(int n, Func<T> f) { var rt = new T[n]; for (var i = 0; i < rt.Length; ++i) rt[i] = f(); return rt; }
    public static T[] Create<T>(int n, Func<int, T> f) { var rt = new T[n]; for (var i = 0; i < rt.Length; ++i) rt[i] = f(i); return rt; }
    public static IEnumerable<T> Shuffle<T>(this IEnumerable<T> A) => A.OrderBy(v => Guid.NewGuid());
    public static int CompareTo<T>(this T[] A, T[] B, Comparison<T> cmp = null) { cmp = cmp ?? Comparer<T>.Default.Compare; for (var i = 0; i < Min(A.Length, B.Length); i++) { int c = cmp(A[i], B[i]); if (c > 0) return 1; else if (c < 0) return -1; } if (A.Length == B.Length) return 0; if (A.Length > B.Length) return 1; else return -1; }
    public static int MaxElement<T>(this IList<T> A, Comparison<T> cmp = null) { cmp = cmp ?? Comparer<T>.Default.Compare; T max = A[0]; int rt = 0; for (int i = 1; i < A.Count; i++) if (cmp(max, A[i]) < 0) { max = A[i]; rt = i; } return rt; }
    public static T PopBack<T>(this List<T> A) { var v = A[A.Count - 1]; A.RemoveAt(A.Count - 1); return v; }
    public static void Fail<T>(T s) { Console.WriteLine(s); Console.Out.Close(); Environment.Exit(0); }
}
public class Scanner
{
    public string Str => Console.ReadLine().Trim();
    public int Int => int.Parse(Str);
    public long Long => long.Parse(Str);
    public double Double => double.Parse(Str);
    public int[] ArrInt => Str.Split(' ').Select(int.Parse).ToArray();
    public long[] ArrLong => Str.Split(' ').Select(long.Parse).ToArray();
    public char[][] Grid(int n) => Create(n, () => Str.ToCharArray());
    public int[] ArrInt1D(int n) => Create(n, () => Int);
    public long[] ArrLong1D(int n) => Create(n, () => Long);
    public int[][] ArrInt2D(int n) => Create(n, () => ArrInt);
    public long[][] ArrLong2D(int n) => Create(n, () => ArrLong);
    private Queue<string> q = new Queue<string>();
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    public T Next<T>() { if (q.Count == 0) foreach (var item in Str.Split(' ')) q.Enqueue(item); return (T)Convert.ChangeType(q.Dequeue(), typeof(T)); }
    public void Make<T1>(out T1 v1) => v1 = Next<T1>();
    public void Make<T1, T2>(out T1 v1, out T2 v2) { v1 = Next<T1>(); v2 = Next<T2>(); }
    public void Make<T1, T2, T3>(out T1 v1, out T2 v2, out T3 v3) { Make(out v1, out v2); v3 = Next<T3>(); }
    public void Make<T1, T2, T3, T4>(out T1 v1, out T2 v2, out T3 v3, out T4 v4) { Make(out v1, out v2, out v3); v4 = Next<T4>(); }
    public void Make<T1, T2, T3, T4, T5>(out T1 v1, out T2 v2, out T3 v3, out T4 v4, out T5 v5) { Make(out v1, out v2, out v3, out v4); v5 = Next<T5>(); }
    public void Make<T1, T2, T3, T4, T5, T6>(out T1 v1, out T2 v2, out T3 v3, out T4 v4, out T5 v5, out T6 v6) { Make(out v1, out v2, out v3, out v4, out v5); v6 = Next<T6>(); }
    public void Make<T1, T2, T3, T4, T5, T6, T7>(out T1 v1, out T2 v2, out T3 v3, out T4 v4, out T5 v5, out T6 v6, out T7 v7) { Make(out v1, out v2, out v3, out v4, out v5, out v6); v7 = Next<T7>(); }
    //public (T1, T2) Make<T1, T2>() { Make(out T1 v1, out T2 v2); return (v1, v2); }
    //public (T1, T2, T3) Make<T1, T2, T3>() { Make(out T1 v1, out T2 v2, out T3 v3); return (v1, v2, v3); }
    //public (T1, T2, T3, T4) Make<T1, T2, T3, T4>() { Make(out T1 v1, out T2 v2, out T3 v3, out T4 v4); return (v1, v2, v3, v4); }
}
public class Pair<T1, T2> : IComparable<Pair<T1, T2>>
{
    public T1 v1;
    public T2 v2;
    public Pair() { }
    public Pair(T1 v1, T2 v2)
    { this.v1 = v1; this.v2 = v2; }

    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    public int CompareTo(Pair<T1, T2> p)
    {
        var c = Comparer<T1>.Default.Compare(v1, p.v1);
        if (c == 0)
            c = Comparer<T2>.Default.Compare(v2, p.v2);
        return c;
    }
    public override string ToString() => $"{v1.ToString()} {v2.ToString()}";
    public void Deconstruct(out T1 a, out T2 b) { a = v1; b = v2; }
}

public class Pair<T1, T2, T3> : Pair<T1, T2>, IComparable<Pair<T1, T2, T3>>
{
    public T3 v3;
    public Pair() : base() { }
    public Pair(T1 v1, T2 v2, T3 v3) : base(v1, v2)
    { this.v3 = v3; }

    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    public int CompareTo(Pair<T1, T2, T3> p)
    {
        var c = base.CompareTo(p);
        if (c == 0)
            c = Comparer<T3>.Default.Compare(v3, p.v3);
        return c;
    }
    public override string ToString() => $"{base.ToString()} {v3.ToString()}";
    public void Deconstruct(out T1 a, out T2 b, out T3 c) { Deconstruct(out a, out b); c = v3; }
}
#endregion


using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Text;

namespace Make_a_Square
{
    internal class Program
    {
        private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024*10), Encoding.ASCII, false, 1024*10);
        private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024*10), Encoding.ASCII, 1024*10);

        private static void Main(string[] args)
        {
            writer.WriteLine(Solve(args));
            writer.Flush();
        }

        private static int Solve(string[] args)
        {
            string s = reader.ReadLine();
            int n = int.Parse(s);

            var st = new Stack<long>();
            for (long i = 1;; i++)
            {
                long ii = i*i;
                if (ii > n)
                    break;
                st.Push(ii);
            }

            foreach (long l in st)
            {
                string t = l.ToString(CultureInfo.InvariantCulture);
                int index = s.Length - 1;
                bool ok = true;

                for (int i = t.Length - 1; i >= 0; i--)
                {
                    while (index >= 0 && t[i] != s[index])
                    {
                        index--;
                    }
                    if (index >= 0)
                        index--;
                    else
                    {
                        ok = false;
                        break;
                    }
                }

                if (ok)
                    return s.Length - t.Length;
            }

            return -1;
        }
    }
}


using System;
using System.CodeDom;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Globalization;
using System.Linq;
using System.Net.NetworkInformation;
using System.Runtime.InteropServices;
using System.Timers;
using System.Xml.Serialization;

class Program
{
    static void Main(string[] args)
    {

        var n = Console.ReadLine();

        //var arr = Console.ReadLine().Split(' ').Select(long.Parse).ToArray();

        //var n = arr[0];
        //var a = arr[1];
        //var b = arr[2];

        //string str = Console.ReadLine();

        var c = bruteforce(string.Empty, n, 0, 0);
        if (c == int.MaxValue)
            c = -1;

        Console.WriteLine(c);
    }

    static int bruteforce(string cur, string actual, int i, int removes)
    {
        if (i >= actual.Length)
        {
            if(string.IsNullOrEmpty(cur))
                return Int32.MaxValue;

            int val = int.Parse(cur);

            var sq = Math.Sqrt(val);

            if ((sq % 1) == 0)
                return removes;

            return Int32.MaxValue;
        }

        if (string.IsNullOrEmpty(cur))
        {
            if (actual[i] == '0')
            {
                return bruteforce(cur, actual, i + 1, removes + 1);
            }

            else
            {
                var c1 =  bruteforce(cur + actual[i], actual, i + 1, removes);
                var c2 = bruteforce(cur, actual, i + 1, removes + 1);

                return Math.Min(c1, c2);
            }

        }
        else
        {
            var cur1 = cur + actual[i];
            var cur2 = cur;
            return Math.Min(bruteforce(cur1, actual, i + 1, removes), bruteforce(cur2, actual, i + 1, removes + 1));
        }
        return int.MaxValue;
    }
}


using System;
using System.Collections.Generic;
using System.Text;
using System.Linq;
using System.Numerics;

namespace dhsmfeh_zhelddmf_gkqslek
{
    class Priority_queue<T>
    {
        static List<int> pq;
        public Priority_queue()
        {
            pq = new List<int>();
        }

        public void push(int num)
        {
            int idx = -1;

            if (pq.Count == 0)
            {
                pq.Add(num);
                return;
            }

            for (int i = pq.Count; --i > -1;)
            {
                if (pq[i] < num)
                {
                    idx = i + 1;
                    break;
                }
            }

            if (idx == -1) { idx = 0; }
            pq.Insert(idx, num);
        }

        public int pop(int num)
        {
            int answer = pq[num];
            pq.RemoveAt(num);
            return answer;
        }

        public int count
        {
            get
            {
                return pq.Count;
            }
        }
    }
    class Program
    {
        static StringBuilder sb = new StringBuilder();
        static void Main(string[] args)
        {
            string str = Console.ReadLine();
            int length = str.Length;
            int num = (int)Math.Pow(2, str.Length) - 1;
            int answer = 0;
            for(int i = num; i>=1; i--)
            {
                string two = Convert.ToString(i, 2);
                int loop = two.Length;
                for(int x = 0; x<length - loop; x++)
                {
                    two = '0' + two;
                }

                for(int y = 0; y < length; y++)
                {
                    if(two[y] == '1')
                    {
                        sb.Append(str[y]);
                    }
                }
                int test_num = int.Parse(sb.ToString());
                if (Math.Sqrt(test_num) == (int)Math.Sqrt(test_num))
                {
                    if((int)Math.Log10(test_num)+1 > answer)
                    {
                        answer = (int)Math.Log10(test_num) + 1;
                    }
                }

                sb.Clear();
            }
            if(answer == 0)
            {
                Console.WriteLine(-1);
            }
            else
            {
                Console.WriteLine(length - answer);
            }
        }
    }
}


using System;
using System.Collections.Generic;

namespace CodeForecs
{
    class Program
    {
        static void Main(string[] args)
        {
            string num = Console.ReadLine();
            int res = MakeSquare(num, 0);
            Console.WriteLine(res == 1000 ? -1 : res);
            //Console.ReadKey();
        }

        private static int MakeSquare(string str, int digit)
        {
            if (NoLeadingZeros(str) && IsASquare(Convert.ToInt32(str)))
            {
                return digit;
            }

            List<string> lst = new List<string>();

            for (int i = 0; i < str.Length; i++)
            {
                string temp = str.Remove(i, 1);
                if (temp.Length != 0)
                    lst.Add(temp);
            }

            int ans = 1000;
            foreach (string temp in lst)
            {
                ans = Math.Min(ans, MakeSquare(temp, digit + 1));
            }

            return ans;
        }

        private static bool NoLeadingZeros(string str)
        {
            return str[0] != '0';
        }

        private static bool IsASquare(int num)
        {
            for (int i = 1; i * i <= num; i++)
            {
                if (i * i == num)
                {
                    return true;
                }
            }

            return false;
        }
    }
}


using System;
using System.Collections.Generic;

namespace CodeForecs
{
    class Program
    {
        static void Main(string[] args)
        {
            string num = Console.ReadLine();
            int res = MakeSquare(num, 0);
            Console.WriteLine(res == 1000 ? -1 : res);
            //Console.ReadKey();
        }

        private static int MakeSquare(string str, int digit)
        {
            if(IsASquare(Convert.ToInt32(str)))
            {
                return digit;
            }

            List<string> lst = new List<string>();

            for(int i = 0; i < str.Length; i++)
            {
                string temp = str.Remove(i, 1);
                if(temp.Length != 0)
                lst.Add(temp);
            }

            int ans = 1000;
            foreach(string temp in lst)
            {
                ans = Math.Min(ans, MakeSquare(temp, digit + 1));
            }

            return ans;
        }

        private static bool IsASquare(int num)
        {
            for(int i = 1; i * i <= num; i++)
            {
                if(i * i == num)
                {
                    return true;
                }
            }

            return false;
        }
    }
}


using System;
using System.Collections.Generic;
using System.Text;
using System.Linq;
using System.Numerics;

namespace dhsmfeh_zhelddmf_gkqslek
{
    class Priority_queue<T>
    {
        static List<int> pq;
        public Priority_queue()
        {
            pq = new List<int>();
        }

        public void push(int num)
        {
            int idx = -1;

            if (pq.Count == 0)
            {
                pq.Add(num);
                return;
            }

            for (int i = pq.Count; --i > -1;)
            {
                if (pq[i] < num)
                {
                    idx = i + 1;
                    break;
                }
            }

            if (idx == -1) { idx = 0; }
            pq.Insert(idx, num);
        }

        public int pop(int num)
        {
            int answer = pq[num];
            pq.RemoveAt(num);
            return answer;
        }

        public int count
        {
            get
            {
                return pq.Count;
            }
        }
    }
    class Program
    {
        static StringBuilder sb = new StringBuilder();
        static void Main(string[] args)
        {
            string str = Console.ReadLine();
            int length = str.Length;
            int num = (int)Math.Pow(2, str.Length) - 1;
            int answer = 0;
            for(int i = num; i>=1; i--)
            {
                string two = Convert.ToString(i, 2);
                int loop = two.Length;
                for(int x = 0; x<length - loop; x++)
                {
                    two = '0' + two;
                }

                for(int y = 0; y < length; y++)
                {
                    if(two[y] == '1')
                    {
                        sb.Append(str[y]);
                    }
                }

                if(Math.Sqrt(int.Parse(sb.ToString())) == (int)Math.Sqrt(int.Parse(sb.ToString())))
                {
                    if((int)Math.Log10(int.Parse(sb.ToString()))+1 > answer)
                    {
                        answer = sb.ToString().Length;
                        Console.WriteLine(sb.ToString());
                    }
                }

                sb.Clear();
            }
            if(answer == 0)
            {
                Console.WriteLine(-1);
            }
            else
            {
                Console.WriteLine(length - answer);
            }
        }
    }
}


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

namespace ConsoleApp {

    class Program {

        static void Main(string[] args) {

            string number = Console.ReadLine().Trim();
            int step = -1;
            MinStep(0, 0, number, Fill(new int[number.Length], 1), ref step);

            Console.WriteLine(step);
        }

        public static bool IsSquare(string number) {

            return Math.Pow((int)Math.Sqrt(int.Parse(number)), 2) == int.Parse(number);
        }

        public static int[] Fill(int[] array, int value) {

            for(int i = 0; i < array.Length; i++) {

                array[i] = value;
            }

            return array;
        }

        public static string GetNumber(string number, int[] usage) {

            var result = new StringBuilder();

            for(int i = 0; i < usage.Length; i++) {

                if(usage[i] == 1) {

                    result.Append(number[i]);
                }
            }

            return result.ToString();
        }

        public static void MinStep(int counter, int total, string number, int[] usage, ref int min) {

            string newNum = GetNumber(number, usage);

            if(newNum == string.Empty || newNum[0] == '0' || counter == number.Length) {

                return;
            }

            if(IsSquare(GetNumber(number, usage))) {

                min = min == -1 ? total : Math.Min(min, total);

                return;
            }

            int[] newUsage = usage.ToList().ToArray();
            newUsage[counter] = 0;
            MinStep(counter + 1, total + 1, number, newUsage, ref min);
            MinStep(counter + 1, total, number, usage, ref min);
        }
    }
}


using System;
using System.Collections.Generic;

namespace CodeForecs
{
    class Program
    {
        static void Main(string[] args)
        {
            string num = Console.ReadLine();
            int res = MakeSquare(num, 0);
            Console.WriteLine(res == 1000 ? -1 : res);
            //Console.ReadKey();
        }

        private static int MakeSquare(string str, int digit)
        {
            if(IsASquare(Convert.ToInt32(str)))
            {
                return digit;
            }

            List<string> lst = new List<string>();

            for(int i = 0; i < str.Length; i++)
            {
                string temp = str.Remove(i, 1);
                if(temp.Length != 0)
                lst.Add(temp);
            }

            int ans = 1000;
            foreach(string temp in lst)
            {
                ans = Math.Min(ans, MakeSquare(temp, digit + 1));
            }

            return ans;
        }

        private static bool IsASquare(int num)
        {
            for(int i = 0; i * i <= num; i++)
            {
                if(i * i == num)
                {
                    return true;
                }
            }

            return false;
        }
    }
}


using System;
using System.Linq;

namespace test
{
	class Test
	{
	    static int min;
	    static int n;

	    static int IsSqrt(String str)
	    {
	        //Console.WriteLine(str.Length);
	        if(Math.Sqrt(int.Parse(str)) % 1 == 0)
	        {
	            return n - str.Length;
	        }
	        else
	        {
	            if(str.Length > 1)
	            {
    	            int minl = 11;
    	            for(int i = 0; i < str.Length; i++)
    	            {
    	                String nextstr = str.Remove(i, 1);
    	                int res = IsSqrt(nextstr);
    	                if(res < minl)
    	                {
    	                    minl = res;
    	                }
    	            }
    	            return minl;
	            }
	            else
	            {
	                return 11;
	            }
	        }
	    }

		static void Main(string[] args)
		{
		    //in
		    String num = Console.ReadLine();

		    //comp
		    min = 0;
		    n = num.Length;

		    min = IsSqrt(num);
		    if(min == 11)
		        min = -1;

		    //out
			Console.WriteLine(min);
		}
	}
}


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

namespace SedlajKvadrat
{
    class Program
    {
       static int minMoves;

       private static void GetSquare(int n,int moves)
       {
           if (Math.Pow(Math.Floor(Math.Sqrt(n)),2)==n)
           {
               if (moves < minMoves) minMoves = moves;
               return;
           }

           if (n < 10) return;

           string s = n.ToString();
           for (int i=0;i<s.Length;i++)
           {
               if (i==s.Length-1 || s[i+1]!='0')
               {
                   string p = s.Remove(i, 1);
                   GetSquare(Convert.ToInt32(p), moves + 1);
               }
           }
       }

       static void Main(string[] args)
       {
           int n = int.Parse(Console.ReadLine());
           minMoves = 11;
           GetSquare(n, 0);

           if (minMoves<11)
               Console.Write(minMoves);
           else
               Console.Write(-1);

       }
    }
}


using System;
using System.Collections.Generic;
using System.Text;
using System.Linq;
using System.Numerics;

namespace dhsmfeh_zhelddmf_gkqslek
{
    class Priority_queue<T>
    {
        static List<int> pq;
        public Priority_queue()
        {
            pq = new List<int>();
        }

        public void push(int num)
        {
            int idx = -1;

            if (pq.Count == 0)
            {
                pq.Add(num);
                return;
            }

            for (int i = pq.Count; --i > -1;)
            {
                if (pq[i] < num)
                {
                    idx = i + 1;
                    break;
                }
            }

            if (idx == -1) { idx = 0; }
            pq.Insert(idx, num);
        }

        public int pop(int num)
        {
            int answer = pq[num];
            pq.RemoveAt(num);
            return answer;
        }

        public int count
        {
            get
            {
                return pq.Count;
            }
        }
    }
    class Program
    {
        static StringBuilder sb = new StringBuilder();
        static void Main(string[] args)
        {
            string str = Console.ReadLine();
            int length = str.Length;
            int num = (int)Math.Pow(2, str.Length) - 1;
            int answer = 0;
            for(int i = num; i>=1; i--)
            {
                string two = Convert.ToString(i, 2);
                int loop = two.Length;
                for(int x = 0; x<length - loop; x++)
                {
                    two = '0' + two;
                }

                for(int y = 0; y < length; y++)
                {
                    if(two[y] == '1')
                    {
                        sb.Append(str[y]);
                    }
                }

                if(Math.Sqrt(int.Parse(sb.ToString())) == (int)Math.Sqrt(int.Parse(sb.ToString())))
                {
                    if(sb.ToString().Length > answer)
                    {
                        answer = sb.ToString().Length;
                    }
                }

                sb.Clear();
            }
            int finish = length - answer;
            if(answer == 0)
            {
                Console.WriteLine(-1);
            }
            else
            {
                Console.WriteLine(finish);
            }
        }
    }
}


using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Text;

class Program
{
    private static bool IsSquare(int n)
    {
        var root = (int)(Math.Sqrt(n));
        if (root * root == n) return true;
        root++;
        if (root * root == n) return true;

        return false;
    }

    private static int[] dp = new int[1000000];
    private static int Solve(int n)
    {
        if (IsSquare(n)) return 0;
        if (n < dp.Length && dp[n] > 0) return dp[n];
        var ans = 10000;
        var s = n.ToString();
        if (s.Length == 1) return 100;

        int startPos = 0;
        if (s.Length > 1 && s[1] == '0') startPos = 1;

        for (int i = startPos; i < s.Length; i++)
        {
            var ss = s.Remove(i, 1);
            ans = Math.Min(ans, 1 + Solve(int.Parse(ss)));
        }

        dp[n] = ans;

        return ans;
    }

    private static void Main(string[] args)
    {
        var n = RI();
        Console.WriteLine(Solve(n));
    }

    private const int Mod = 1000000000 + 7;

    #region Data Read

    private static int GCD(int a, int b)
    {
        if (a % b == 0) return b;
        return GCD(b, a % b);
    }

    private static List<int>[] ReadTree(int n)
    {
        return ReadGraph(n, n - 1);
    }

    private static List<int>[] ReadGraph(int n, int m)
    {
        List<int>[] g = new List<int>[n];
        for (int i = 0; i < g.Length; i++) g[i] = new List<int>();
        for (int i = 0; i < m; i++)
        {
            int a = RI() - 1;
            int b = RI() - 1;

            g[a].Add(b);
            g[b].Add(a);
        }

        return g;
    }

    private static int[,] ReadGraphAsMatrix(int n, int m)
    {
        int[,] matrix = new int[n + 1, n + 1];
        for (int i = 0; i < m; i++)
        {
            int a = RI();
            int b = RI();
            matrix[a, b] = matrix[b, a] = 1;
        }

        return matrix;
    }

    private static void Sort(ref int a, ref int b)
    {
        if (a > b) Swap(ref a, ref b);
    }

    private static void Swap(ref int a, ref int b)
    {
        int tmp = a;
        a = b;
        b = tmp;
    }

    private const int BufferSize = 1 << 16;
    private static StreamReader consoleReader;
    private static MemoryStream testData;

    private static int RI()
    {
        int ans = 0;
        int mul = 1;
        do
        {
            ans = consoleReader.Read();
            if (ans == -1)
                return 0;
            if (ans == '-') mul = -1;
        } while (ans < '0' || ans > '9');

        ans -= '0';
        while (true)
        {
            int chr = consoleReader.Read();
            if (chr < '0' || chr > '9')
                return ans * mul;
            ans = ans * 10 + chr - '0';
        }
    }

    private static ulong RUL()
    {
        ulong ans = 0;
        int chr;
        do
        {
            chr = consoleReader.Read();
            if (chr == -1)
                return 0;
        } while (chr < '0' || chr > '9');

        ans = (uint)(chr - '0');
        while (true)
        {
            chr = consoleReader.Read();
            if (chr < '0' || chr > '9')
                return ans;
            ans = ans * 10 + (uint)(chr - '0');
        }
    }

    private static long RL()
    {
        long ans = 0;
        int mul = 1;
        do
        {
            ans = consoleReader.Read();
            if (ans == -1)
                return 0;
            if (ans == '-') mul = -1;
        } while (ans < '0' || ans > '9');

        ans -= '0';
        while (true)
        {
            int chr = consoleReader.Read();
            if (chr < '0' || chr > '9')
                return ans * mul;
            ans = ans * 10 + chr - '0';
        }
    }

    private static int[] RIA(int n)
    {
        int[] ans = new int[n];
        for (int i = 0; i < n; i++)
            ans[i] = RI();
        return ans;
    }

    private static long[] RLA(int n)
    {
        long[] ans = new long[n];
        for (int i = 0; i < n; i++)
            ans[i] = RL();
        return ans;
    }

    private static char[] ReadWord()
    {
        int ans;

        do
        {
            ans = consoleReader.Read();
        } while (!((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z') || (ans == '*')));

        List<char> s = new List<char>();
        do
        {
            s.Add((char)ans);
            ans = consoleReader.Read();
        } while ((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z') || (ans == '*'));

        return s.ToArray();
    }

    private static char[] ReadString(int n)
    {
        int ans;

        do
        {
            ans = consoleReader.Read();
        } while (!((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z')));

        char[] s = new char[n];
        int pos = 0;
        do
        {
            s[pos++] = (char)ans;
            if (pos == n) break;
            ans = consoleReader.Read();
        } while ((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z'));

        return s;
    }

    private static char[] ReadStringLine()
    {
        int ans;

        do
        {
            ans = consoleReader.Read();
        } while (ans == 10 || ans == 13);

        List<char> s = new List<char>();

        do
        {
            s.Add((char)ans);
            ans = consoleReader.Read();
        } while (ans != 10 && ans != 13 && ans != -1);

        return s.ToArray();
    }

    private static char ReadLetter()
    {
        while (true)
        {
            int ans = consoleReader.Read();
            if ((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z'))
                return (char)ans;
        }
    }
    private static char ReadNonLetter()
    {
        while (true)
        {
            int ans = consoleReader.Read();
            if (!((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z')))
                return (char)ans;
        }
    }

    private static char ReadAnyOf(IEnumerable<char> allowed)
    {
        while (true)
        {
            char ans = (char)consoleReader.Read();
            if (allowed.Contains(ans))
                return ans;
        }
    }

    private static char ReadDigit()
    {
        while (true)
        {
            int ans = consoleReader.Read();
            if (ans >= '0' && ans <= '9')
                return (char)ans;
        }
    }

    private static int ReadDigitInt()
    {
        return ReadDigit() - (int)'0';
    }

    private static char ReadAnyChar()
    {
        return (char)consoleReader.Read();
    }

    private static string DoubleToString(double x)
    {
        return x.ToString(CultureInfo.InvariantCulture);
    }

    private static double DoubleFromString(string x)
    {
        return double.Parse(x, CultureInfo.InvariantCulture);
    }

    static Program()
    {
        //Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;
        consoleReader = new StreamReader(Console.OpenStandardInput(BufferSize), Encoding.ASCII, false, BufferSize);
    }

    private static void PushTestData(StringBuilder sb)
    {
        PushTestData(sb.ToString());
    }
    private static void PushTestData(string data)
    {
#if TOLYAN_TEST
        if (testData == null)
        {
            testData = new MemoryStream();
            consoleReader = new StreamReader(testData);
        }

        var pos = testData.Position;
        var bytes = Encoding.UTF8.GetBytes(data);
        testData.Write(bytes, 0, bytes.Length);
        testData.Flush();
        testData.Position = pos;
#endif
    }
    #endregion
}


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

namespace ConsoleApp {

    class Program {

        static void Main(string[] args) {

            string number = "333";
            int step = -1;
            MinStep(0, 0, number, Fill(new int[number.Length], 1), ref step);

            Console.WriteLine(step);
        }

        public static bool IsSquare(string number) {

            return Math.Pow((int)Math.Sqrt(int.Parse(number)), 2) == int.Parse(number);
        }

        public static int[] Fill(int[] array, int value) {

            for(int i = 0; i < array.Length; i++) {

                array[i] = value;
            }

            return array;
        }

        public static string GetNumber(string number, int[] usage) {

            var result = new StringBuilder();

            for(int i = 0; i < usage.Length; i++) {

                if(usage[i] == 1) {

                    result.Append(number[i]);
                }
            }

            return result.ToString();
        }

        public static void MinStep(int counter, int total, string number, int[] usage, ref int min) {

            string newNum = GetNumber(number, usage);

            if(newNum == string.Empty || newNum[0] == '0' || counter == number.Length) {

                return;
            }

            if(IsSquare(GetNumber(number, usage))) {

                min = min == -1 ? total : Math.Min(min, total);

                return;
            }

            int[] newUsage = usage.ToList().ToArray();
            newUsage[counter] = 0;
            MinStep(counter + 1, total + 1, number, newUsage, ref min);
            MinStep(counter + 1, total, number, usage, ref min);
        }
    }
}


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

namespace ConsoleApp {

    class Program {

        static void Main(string[] args) {

            string number = "333";
            int step = -1;
            MinStep(0, 0, number, Fill(new int[number.Length], 1), ref step);

            Console.WriteLine(step);
        }

        public static bool IsSquare(string number) {

            return Math.Pow((int)Math.Sqrt(int.Parse(number)), 2) == int.Parse(number);
        }

        public static int[] Fill(int[] array, int value) {

            for(int i = 0; i < array.Length; i++) {

                array[i] = value;
            }

            return array;
        }

        public static string GetNumber(string number, int[] usage) {

            var result = new StringBuilder();

            for(int i = 0; i < usage.Length; i++) {

                if(usage[i] == 1) {

                    result.Append(number[i]);
                }
            }

            return result.ToString();
        }

        public static void MinStep(int counter, int total, string number, int[] usage, ref int min) {

            if(GetNumber(number, usage) != string.Empty && IsSquare(GetNumber(number, usage))) {

                min = min == -1 ? total : Math.Min(min, total);

                return;
            }

            if(counter == number.Length) {

                return;
            }

            int[] newUsage = usage.ToList().ToArray();
            newUsage[counter] = 0;
            MinStep(counter + 1, total + 1, number, newUsage, ref min);
            MinStep(counter + 1, total, number, usage, ref min);
        }
    }
}


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

namespace ConsoleApp {

    class Program {

        static void Main(string[] args) {

            string number = Console.ReadLine().Trim();
            int step = -1;
            MinStep(0, 0, number, Fill(new int[number.Length], 1), ref step);

            Console.WriteLine(step);
        }

        public static bool IsSquare(string number) {

            return Math.Pow((int)Math.Sqrt(int.Parse(number)), 2) == int.Parse(number);
        }

        public static int[] Fill(int[] array, int value) {

            for(int i = 0; i < array.Length; i++) {

                array[i] = value;
            }

            return array;
        }

        public static string GetNumber(string number, int[] usage) {

            var result = new StringBuilder();

            for(int i = 0; i < usage.Length; i++) {

                if(usage[i] == 1) {

                    result.Append(number[i]);
                }
            }

            return result.ToString();
        }

        public static void MinStep(int counter, int total, string number, int[] usage, ref int min) {

            string newNum = GetNumber(number, usage);

            if(newNum == string.Empty || counter == number.Length) {

                return;
            }

            if(newNum[0] != '0' && IsSquare(GetNumber(number, usage))) {

                min = min == -1 ? total : Math.Min(min, total);

                return;
            }

            int[] newUsage = usage.ToList().ToArray();
            newUsage[counter] = 0;
            MinStep(counter + 1, total + 1, number, newUsage, ref min);
            MinStep(counter + 1, total, number, usage, ref min);
        }
    }
}


using System;
using System.Collections.Generic;

namespace CodeForecs
{
    class Program
    {
        static void Main(string[] args)
        {
            string num = Console.ReadLine();
            int res = MakeSquare(num, 0);
            Console.WriteLine(res == 1000 ? -1 : res);
            //Console.ReadKey();
        }

        private static int MakeSquare(string str, int digit)
        {
            if (IsASquare(Convert.ToInt32(str)))
            {
                return digit;
            }

            List<string> lst = new List<string>();

            for (int i = 0; i < str.Length; i++)
            {
                string temp = str.Remove(i, 1);
                if (temp.Length != 0)
                    lst.Add(temp);
            }

            int ans = 1000;
            foreach (string temp in lst)
            {
                ans = Math.Min(ans, MakeSquare(temp, digit + 1));
            }

            return ans;
        }

        private static bool IsASquare(int num)
        {
            for (int i = 1; i * i <= num; i++)
            {
                if (i * i == num)
                {
                    return true;
                }
            }

            return false;
        }
    }
}


using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Text;

class Program
{
    private static bool IsSquare(int n)
    {
        var root = (int)(Math.Sqrt(n));
        if (root * root == n) return true;
        root++;
        if (root * root == n) return true;

        return false;
    }

    private static int[] dp = new int[1000000];
    private static int Solve(int n)
    {
        if (IsSquare(n)) return 0;
        if (n < dp.Length && dp[n] > 0) return dp[n];
        var ans = 10000;
        var s = n.ToString();

        int startPos = 0;
        if (s.Length > 1 && s[1] == '0') startPos = 1;

        for (int i = startPos; i < s.Length; i++)
        {
            var ss = s.Remove(i, 1);
            ans = Math.Min(ans, 1 + Solve(int.Parse(ss)));
        }

        dp[n] = ans;

        return ans;
    }

    private static void Main(string[] args)
    {
        var n = RI();
        Console.WriteLine(Solve(n));
    }

    private const int Mod = 1000000000 + 7;

    #region Data Read

    private static int GCD(int a, int b)
    {
        if (a % b == 0) return b;
        return GCD(b, a % b);
    }

    private static List<int>[] ReadTree(int n)
    {
        return ReadGraph(n, n - 1);
    }

    private static List<int>[] ReadGraph(int n, int m)
    {
        List<int>[] g = new List<int>[n];
        for (int i = 0; i < g.Length; i++) g[i] = new List<int>();
        for (int i = 0; i < m; i++)
        {
            int a = RI() - 1;
            int b = RI() - 1;

            g[a].Add(b);
            g[b].Add(a);
        }

        return g;
    }

    private static int[,] ReadGraphAsMatrix(int n, int m)
    {
        int[,] matrix = new int[n + 1, n + 1];
        for (int i = 0; i < m; i++)
        {
            int a = RI();
            int b = RI();
            matrix[a, b] = matrix[b, a] = 1;
        }

        return matrix;
    }

    private static void Sort(ref int a, ref int b)
    {
        if (a > b) Swap(ref a, ref b);
    }

    private static void Swap(ref int a, ref int b)
    {
        int tmp = a;
        a = b;
        b = tmp;
    }

    private const int BufferSize = 1 << 16;
    private static StreamReader consoleReader;
    private static MemoryStream testData;

    private static int RI()
    {
        int ans = 0;
        int mul = 1;
        do
        {
            ans = consoleReader.Read();
            if (ans == -1)
                return 0;
            if (ans == '-') mul = -1;
        } while (ans < '0' || ans > '9');

        ans -= '0';
        while (true)
        {
            int chr = consoleReader.Read();
            if (chr < '0' || chr > '9')
                return ans * mul;
            ans = ans * 10 + chr - '0';
        }
    }

    private static ulong RUL()
    {
        ulong ans = 0;
        int chr;
        do
        {
            chr = consoleReader.Read();
            if (chr == -1)
                return 0;
        } while (chr < '0' || chr > '9');

        ans = (uint)(chr - '0');
        while (true)
        {
            chr = consoleReader.Read();
            if (chr < '0' || chr > '9')
                return ans;
            ans = ans * 10 + (uint)(chr - '0');
        }
    }

    private static long RL()
    {
        long ans = 0;
        int mul = 1;
        do
        {
            ans = consoleReader.Read();
            if (ans == -1)
                return 0;
            if (ans == '-') mul = -1;
        } while (ans < '0' || ans > '9');

        ans -= '0';
        while (true)
        {
            int chr = consoleReader.Read();
            if (chr < '0' || chr > '9')
                return ans * mul;
            ans = ans * 10 + chr - '0';
        }
    }

    private static int[] RIA(int n)
    {
        int[] ans = new int[n];
        for (int i = 0; i < n; i++)
            ans[i] = RI();
        return ans;
    }

    private static long[] RLA(int n)
    {
        long[] ans = new long[n];
        for (int i = 0; i < n; i++)
            ans[i] = RL();
        return ans;
    }

    private static char[] ReadWord()
    {
        int ans;

        do
        {
            ans = consoleReader.Read();
        } while (!((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z') || (ans == '*')));

        List<char> s = new List<char>();
        do
        {
            s.Add((char)ans);
            ans = consoleReader.Read();
        } while ((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z') || (ans == '*'));

        return s.ToArray();
    }

    private static char[] ReadString(int n)
    {
        int ans;

        do
        {
            ans = consoleReader.Read();
        } while (!((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z')));

        char[] s = new char[n];
        int pos = 0;
        do
        {
            s[pos++] = (char)ans;
            if (pos == n) break;
            ans = consoleReader.Read();
        } while ((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z'));

        return s;
    }

    private static char[] ReadStringLine()
    {
        int ans;

        do
        {
            ans = consoleReader.Read();
        } while (ans == 10 || ans == 13);

        List<char> s = new List<char>();

        do
        {
            s.Add((char)ans);
            ans = consoleReader.Read();
        } while (ans != 10 && ans != 13 && ans != -1);

        return s.ToArray();
    }

    private static char ReadLetter()
    {
        while (true)
        {
            int ans = consoleReader.Read();
            if ((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z'))
                return (char)ans;
        }
    }
    private static char ReadNonLetter()
    {
        while (true)
        {
            int ans = consoleReader.Read();
            if (!((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z')))
                return (char)ans;
        }
    }

    private static char ReadAnyOf(IEnumerable<char> allowed)
    {
        while (true)
        {
            char ans = (char)consoleReader.Read();
            if (allowed.Contains(ans))
                return ans;
        }
    }

    private static char ReadDigit()
    {
        while (true)
        {
            int ans = consoleReader.Read();
            if (ans >= '0' && ans <= '9')
                return (char)ans;
        }
    }

    private static int ReadDigitInt()
    {
        return ReadDigit() - (int)'0';
    }

    private static char ReadAnyChar()
    {
        return (char)consoleReader.Read();
    }

    private static string DoubleToString(double x)
    {
        return x.ToString(CultureInfo.InvariantCulture);
    }

    private static double DoubleFromString(string x)
    {
        return double.Parse(x, CultureInfo.InvariantCulture);
    }

    static Program()
    {
        //Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;
        consoleReader = new StreamReader(Console.OpenStandardInput(BufferSize), Encoding.ASCII, false, BufferSize);
    }

    private static void PushTestData(StringBuilder sb)
    {
        PushTestData(sb.ToString());
    }
    private static void PushTestData(string data)
    {
#if TOLYAN_TEST
        if (testData == null)
        {
            testData = new MemoryStream();
            consoleReader = new StreamReader(testData);
        }

        var pos = testData.Position;
        var bytes = Encoding.UTF8.GetBytes(data);
        testData.Write(bytes, 0, bytes.Length);
        testData.Flush();
        testData.Position = pos;
#endif
    }
    #endregion
}