import java.io.BufferedReader;
import java.io.DataInputStream;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;

/**
 * Use pen and paper. Solve on paper then code.
 * If there is some reasoning e.g. sequence/paths, try printing first 100 elements or 100 answers using brute and observe.
 * Read question with extreme caution. Sometimes we make question complex due to misunderstanding.
 * Prefix sum and suffix sum is highly usable concept, look for it.
 * Think of cleanest approach. If too many if else are coming then its indication of WA.
 * https://codeforces.com/contest/1354/submission/80639237
 */
public class Codeforces {

	public static void main(String args[]) throws IOException {
		Reader in = new Reader();
//		Scanner in = new Scanner(System.in);
		int t = in.nextInt();
		while (t-->0) {
			int a = in.nextInt(), b = in.nextInt();
			if (a == b) {
				System.out.println(4*a*a);
				continue;
			}
			if (a<b) {
				int tp = a;
				a = b;
				b = tp;
			}
			if (a/2 == b) {
				System.out.println(a*a);
				continue;
			}
			a++;
			System.out.println(a*a);
		}
		in.close();
	}

	static class Reader
    {
        final private int BUFFER_SIZE = 1 << 16;
        private DataInputStream din;
        private byte[] buffer;
        private int bufferPointer, bytesRead;
        StringTokenizer st;
        BufferedReader br;

        public Reader()
        {
            din = new DataInputStream(System.in);
            buffer = new byte[BUFFER_SIZE];
            bufferPointer = bytesRead = 0;
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        public Reader(String file_name) throws IOException
        {
            din = new DataInputStream(new FileInputStream(file_name));
            buffer = new byte[BUFFER_SIZE];
            bufferPointer = bytesRead = 0;
        }

        public String readLine() throws IOException
        {
            byte[] buf = new byte[64]; // line length
            int cnt = 0, c;
            while ((c = read()) != -1)
            {
                if (c == '\n')
                    break;
                buf[cnt++] = (byte) c;
            }
            return new String(buf, 0, cnt);
        }

        public int nextInt() throws IOException
        {
            int ret = 0;
            byte c = read();
            while (c <= ' ')
                c = read();
            boolean neg = (c == '-');
            if (neg)
                c = read();
            do
            {
                ret = ret * 10 + c - '0';
            }  while ((c = read()) >= '0' && c <= '9');

            if (neg)
                return -ret;
            return ret;
        }

        public long nextLong() throws IOException
        {
            long ret = 0;
            byte c = read();
            while (c <= ' ')
                c = read();
            boolean neg = (c == '-');
            if (neg)
                c = read();
            do {
                ret = ret * 10 + c - '0';
            }
            while ((c = read()) >= '0' && c <= '9');
            if (neg)
                return -ret;
            return ret;
        }

        public double nextDouble() throws IOException
        {
            double ret = 0, div = 1;
            byte c = read();
            while (c <= ' ')
                c = read();
            boolean neg = (c == '-');
            if (neg)
                c = read();

            do {
                ret = ret * 10 + c - '0';
            }
            while ((c = read()) >= '0' && c <= '9');

            if (c == '.')
            {
                while ((c = read()) >= '0' && c <= '9')
                {
                    ret += (c - '0') / (div *= 10);
                }
            }

            if (neg)
                return -ret;
            return ret;
        }

        private void fillBuffer() throws IOException
        {
            bytesRead = din.read(buffer, bufferPointer = 0, BUFFER_SIZE);
            if (bytesRead == -1)
                buffer[0] = -1;
        }

        private byte read() throws IOException
        {
            if (bufferPointer == bytesRead)
                fillBuffer();
            return buffer[bufferPointer++];
        }

        public void close() throws IOException
        {
            if (din == null)
                return;
            din.close();
        }

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

    }

}


import java.io.BufferedReader;
import java.io.DataInputStream;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;

/**
 * Use pen and paper. Solve on paper then code.
 * If there is some reasoning e.g. sequence/paths, try printing first 100 elements or 100 answers using brute and observe.
 * Read question with extreme caution. Sometimes we make question complex due to misunderstanding.
 * Prefix sum and suffix sum is highly usable concept, look for it.
 * Think of cleanest approach. If too many if else are coming then its indication of WA.
 * https://codeforces.com/contest/1354/submission/80639237
 */
public class Codeforces {

	public static void main(String args[]) throws IOException {
		Reader in = new Reader();
//		Scanner in = new Scanner(System.in);
		int t = in.nextInt();
		while (t-->0) {
			first(in);
//			third(in);
//			fifth(in);
		}
		in.close();
	}

	private static void first(Reader in) throws IOException {
		int a = in.nextInt(), b = in.nextInt();
		if (a == b) {
			System.out.println(4*a*a);
			return;
		}
		if (a<b) {
			int tp = a;
			a = b;
			b = tp;
		}
		if (a/2>=b) {
			System.out.println(a*a);
			return;
		}
		b = 2*b;
		System.out.println(b*b);
	}

	private static void fifth(Scanner in) {
		int n = in.nextInt(), m = in.nextInt();
		String s[] = new String[n];
		for (int i=0;i<n;i++) s[i] = in.next();

		char c[] = new char[m];
		for (int i=0;i<m;i++) {
			int d[] = new int[256];
			Arrays.fill(d, 0);
			for (int j=0;j<n;j++) {
				d[s[j].charAt(i)]++;
			}
			int max = -1, ind = -1;
			for (int k=0;k<d.length;k++) {
				if (d[k]>max) {
					max = d[k];
					ind = k;
				}
			}
			c[i] = (char) ind;
		}

		for (int i=0;i<n;i++) {
			if (check(s[i], c, n) > 1) {
				System.out.println(-1);
				break;
			}
			if (i == n-1) {
				System.out.println(c);
			}
		}
	}

	private static int check(String s, char[] c, int n) {
		int cnt = 0;
		for (int i=0;i<s.length();i++) {
			if (s.charAt(i) != c[i]) cnt++;
		}
		return cnt;
	}

	private static void dfs(int[][] a, int i, int j, int n, Set<Pair> set) {
		if (invalid) return;
		if (i<0 || i>=n) return;
		if (j<0 || j>=n) return;
		Pair pr = new Pair(i, j);
		if (set.contains(pr)) return;
		if (i == n-1 && j == n-1) {
			set.add(pr);
			return;
		}

		if (a[i][j] == 1) {
			boolean isValid = false;
			if (i < n-1 && a[i+1][j] == 1) {
				isValid = true;
			}
			if (j<n-1 && a[i][j+1] == 1) {
				isValid = true;
			}
			if (j == n-1 || i == n-1) {
				isValid = true;
			}
			if (!isValid) {
				invalid = true;
				return;
			}
		}
		set.add(pr);
		dfs(a,i+1,j,n,set);
		dfs(a,i,j+1,n,set);
	}

	static boolean invalid = false;
	static class Pair {
		Integer x;
		Integer y;
		private Pair(int x, int y) {
			this.x = x;
			this.y = y;
		}

		@Override
		public boolean equals(Object o) {
			if (o == null || !(o instanceof Pair))
				return false;
			Pair cor = (Pair)o;
			return x.equals(cor.x) && y.equals(cor.y);
		}

		@Override
		public int hashCode() {
			int result = 17;
			result = result + 31*x;
			result = result + 31*y;
			return result;
		}

		static class PairComparatorX implements Comparator<Pair> {

			@Override
			public int compare(Pair o1, Pair o2) {
				return o1.x.compareTo(o2.x);
			}

		}

		static class PairComparatorY implements Comparator<Pair> {

			@Override
			public int compare(Pair o1, Pair o2) {
				return o1.y.compareTo(o2.y);
			}

		}

	}

	private static void third(Reader in) throws IOException {
		int n = in.nextInt();
		int a[] = new int[n];
		int odd = 0;
		for (int i=0;i<n;i++) {
			a[i] = in.nextInt();
			if (a[i]%2 != 0) odd++;
		}
		if (odd == n/2) {
			System.out.println();
		}
		Arrays.parallelSort(a);

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

		}
	}

	static class Reader
    {
        final private int BUFFER_SIZE = 1 << 16;
        private DataInputStream din;
        private byte[] buffer;
        private int bufferPointer, bytesRead;
        StringTokenizer st;
        BufferedReader br;

        public Reader()
        {
            din = new DataInputStream(System.in);
            buffer = new byte[BUFFER_SIZE];
            bufferPointer = bytesRead = 0;
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        public Reader(String file_name) throws IOException
        {
            din = new DataInputStream(new FileInputStream(file_name));
            buffer = new byte[BUFFER_SIZE];
            bufferPointer = bytesRead = 0;
        }

        public String readLine() throws IOException
        {
            byte[] buf = new byte[64]; // line length
            int cnt = 0, c;
            while ((c = read()) != -1)
            {
                if (c == '\n')
                    break;
                buf[cnt++] = (byte) c;
            }
            return new String(buf, 0, cnt);
        }

        public int nextInt() throws IOException
        {
            int ret = 0;
            byte c = read();
            while (c <= ' ')
                c = read();
            boolean neg = (c == '-');
            if (neg)
                c = read();
            do
            {
                ret = ret * 10 + c - '0';
            }  while ((c = read()) >= '0' && c <= '9');

            if (neg)
                return -ret;
            return ret;
        }

        public long nextLong() throws IOException
        {
            long ret = 0;
            byte c = read();
            while (c <= ' ')
                c = read();
            boolean neg = (c == '-');
            if (neg)
                c = read();
            do {
                ret = ret * 10 + c - '0';
            }
            while ((c = read()) >= '0' && c <= '9');
            if (neg)
                return -ret;
            return ret;
        }

        public double nextDouble() throws IOException
        {
            double ret = 0, div = 1;
            byte c = read();
            while (c <= ' ')
                c = read();
            boolean neg = (c == '-');
            if (neg)
                c = read();

            do {
                ret = ret * 10 + c - '0';
            }
            while ((c = read()) >= '0' && c <= '9');

            if (c == '.')
            {
                while ((c = read()) >= '0' && c <= '9')
                {
                    ret += (c - '0') / (div *= 10);
                }
            }

            if (neg)
                return -ret;
            return ret;
        }

        private void fillBuffer() throws IOException
        {
            bytesRead = din.read(buffer, bufferPointer = 0, BUFFER_SIZE);
            if (bytesRead == -1)
                buffer[0] = -1;
        }

        private byte read() throws IOException
        {
            if (bufferPointer == bytesRead)
                fillBuffer();
            return buffer[bufferPointer++];
        }

        public void close() throws IOException
        {
            if (din == null)
                return;
            din.close();
        }

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

    }

}


import java.io.BufferedReader;
import java.io.DataInputStream;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;

/**
 * Use pen and paper. Solve on paper then code.
 * If there is some reasoning e.g. sequence/paths, try printing first 100 elements or 100 answers using brute and observe.
 * Read question with extreme caution. Sometimes we make question complex due to misunderstanding.
 * Prefix sum and suffix sum is highly usable concept, look for it.
 * Think of cleanest approach. If too many if else are coming then its indication of WA.
 * https://codeforces.com/contest/1354/submission/80639237
 */
public class Codeforces {

	public static void main(String args[]) throws IOException {
		Reader in = new Reader();
//		Scanner in = new Scanner(System.in);
		int t = in.nextInt();
		while (t-->0) {
			int a = in.nextInt(), b = in.nextInt();
			if (a == b) {
				System.out.println(4*a*a);
				continue;
			}
			if (a<b) {
				int tp = a;
				a = b;
				b = tp;
			}
			if (a/2>=b) {
				System.out.println(a*a);
				continue;
			}
			a++;
			System.out.println(a*a);
		}
		in.close();
	}

	static class Reader
    {
        final private int BUFFER_SIZE = 1 << 16;
        private DataInputStream din;
        private byte[] buffer;
        private int bufferPointer, bytesRead;
        StringTokenizer st;
        BufferedReader br;

        public Reader()
        {
            din = new DataInputStream(System.in);
            buffer = new byte[BUFFER_SIZE];
            bufferPointer = bytesRead = 0;
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        public Reader(String file_name) throws IOException
        {
            din = new DataInputStream(new FileInputStream(file_name));
            buffer = new byte[BUFFER_SIZE];
            bufferPointer = bytesRead = 0;
        }

        public String readLine() throws IOException
        {
            byte[] buf = new byte[64]; // line length
            int cnt = 0, c;
            while ((c = read()) != -1)
            {
                if (c == '\n')
                    break;
                buf[cnt++] = (byte) c;
            }
            return new String(buf, 0, cnt);
        }

        public int nextInt() throws IOException
        {
            int ret = 0;
            byte c = read();
            while (c <= ' ')
                c = read();
            boolean neg = (c == '-');
            if (neg)
                c = read();
            do
            {
                ret = ret * 10 + c - '0';
            }  while ((c = read()) >= '0' && c <= '9');

            if (neg)
                return -ret;
            return ret;
        }

        public long nextLong() throws IOException
        {
            long ret = 0;
            byte c = read();
            while (c <= ' ')
                c = read();
            boolean neg = (c == '-');
            if (neg)
                c = read();
            do {
                ret = ret * 10 + c - '0';
            }
            while ((c = read()) >= '0' && c <= '9');
            if (neg)
                return -ret;
            return ret;
        }

        public double nextDouble() throws IOException
        {
            double ret = 0, div = 1;
            byte c = read();
            while (c <= ' ')
                c = read();
            boolean neg = (c == '-');
            if (neg)
                c = read();

            do {
                ret = ret * 10 + c - '0';
            }
            while ((c = read()) >= '0' && c <= '9');

            if (c == '.')
            {
                while ((c = read()) >= '0' && c <= '9')
                {
                    ret += (c - '0') / (div *= 10);
                }
            }

            if (neg)
                return -ret;
            return ret;
        }

        private void fillBuffer() throws IOException
        {
            bytesRead = din.read(buffer, bufferPointer = 0, BUFFER_SIZE);
            if (bytesRead == -1)
                buffer[0] = -1;
        }

        private byte read() throws IOException
        {
            if (bufferPointer == bytesRead)
                fillBuffer();
            return buffer[bufferPointer++];
        }

        public void close() throws IOException
        {
            if (din == null)
                return;
            din.close();
        }

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

    }

}


import java.io.IOException;
import java.io.InputStream;

public class Main{

     class InputReader {
        private final InputStream stream;
        private final byte[] buf = new byte[1024];

        private int curChar;

        private int numChars;

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

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

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

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

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

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

    public static void main(String[] args) {
          Main m = new Main();
        Main.InputReader s = m.new InputReader(System.in);
        int t = s.readInt();
        StringBuilder sb = new StringBuilder();
        while(t>0){
            int l = s.readInt();
            int  b= s.readInt();
            if(l==b){
                int a = (2*l)*(2*l);
                sb.append(a).append("\n");
                t--;
                continue;
            }
            int area = 2*(l*b);
            sb.append((int)Math.pow(Math.ceil(Math.sqrt(area)),2)).append("\n");
            t--;
        }
        System.out.println(sb);
    }
}


import java.io.IOException;
import java.io.InputStream;

public class Main{

     class InputReader {
        private final InputStream stream;
        private final byte[] buf = new byte[1024];

        private int curChar;

        private int numChars;

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

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

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

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

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

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

    public static void main(String[] args) {
          Main m = new Main();
        Main.InputReader s = m.new InputReader(System.in);
        int t = s.readInt();
//        StringBuilder sb = new StringBuilder();
        while(t>0){
            int l = s.readInt();
            int  b= s.readInt();
            System.out.println((int) Math.pow(Math.min(Math.max(2*l,b),Math.max(l,2*b)),2));
            t--;
        }
    }
}


import java.io.IOException;
import java.io.InputStream;

public class Main{

     class InputReader {
        private final InputStream stream;
        private final byte[] buf = new byte[1024];

        private int curChar;

        private int numChars;

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

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

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

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

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

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

    public static void main(String[] args) {
          Main m = new Main();
        Main.InputReader s = m.new InputReader(System.in);
        int t = s.readInt();
        StringBuilder sb = new StringBuilder();
        while(t>0){
            int l = s.readInt();
            int  b= s.readInt();
            sb.append((int) Math.pow(Math.min(Math.max(2*l,b),Math.max(l,2*b)),2)).append("\n");
            t--;
        }
        System.out.println(sb);
    }
}


import java.util.*;
import java.io.*;
public class Main
{
	public static void main(String[] args) throws IOException{
		BufferedReader in=new BufferedReader(new InputStreamReader(System.in));
		int t=Integer.parseInt(in.readLine());
		while(t-->0)
		{
		    String s[]=in.readLine().split(" ");
		    int a=Integer.parseInt(s[0]);
		    int b=Integer.parseInt(s[1]);
		    int ans=0;
		    if(a==b)
		    {
		        ans=4*a*b;
		    }
		    else{
		        int min=a<b ? a:b;
		        int max=a>b ? a:b;
		        min *= 2;
		        ans = min<max ? max*max: min*min;
		    }
		    System.out.println(ans);
		}
	}
}


package com.contest.div3;
import java.util.*;
import java.io.*;
public class Main
{
	public static void main(String[] args) throws IOException{
		BufferedReader in=new BufferedReader(new InputStreamReader(System.in));
		int t=Integer.parseInt(in.readLine());
		while(t-->0)
		{
		    String s[]=in.readLine().split(" ");
		    int a=Integer.parseInt(s[0]);
		    int b=Integer.parseInt(s[1]);
		    int ans=0;
		    if(a==b)
		    {
		        ans=4*a*b;
		    }
		    else{
		        int min=a<b ? a:b;
		        int max=a>b ? a:b;
		        min *= 2;
		        ans = min<max ? max*max: min*min;
		    }
		    System.out.println(ans);
		}
	}
}


package com.contest.div3;

import java.util.Scanner;

public class SquareAreaOfMinimumRectangle {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
	    int t= sc.nextInt();

	    for(int i=0;i<t;i++)
	    {
	    	int a = sc.nextInt();
	    	int b = sc.nextInt();
	    	findMinimumSquareValue(a,b);
	    }
	}

	private static void findMinimumSquareValue(int a, int b) {

		int min = Math.min(a,b);
        int max = Math.max(a,b);
        if(2*min>max)
        {
            int g =2*min;
            System.out.println(g*g);
        }
        else
        {
            System.out.println(max*max);
        }

	}

}


package com.contest.div3;

import java.util.Scanner;

public class SquareAreaOfMinimumRectangle {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
	    int t= sc.nextInt();

	    for(int i=0;i<t;i++)
	    {
	    	int a = sc.nextInt();
	    	int b = sc.nextInt();
	    	findMinimumSquareValue(a,b);
	    }
	}

	private static void findMinimumSquareValue(int a, int b) {

		int ans = 1;
		int min = Math.min(a, b);
		int length = 2*min;
		int an = Math.max(length, Math.max(a, b));
		System.out.println(an*an);

	}

}


import java.util.*;

public class Solution
{
    public static void main(String ar[])
    {
        Scanner in=new Scanner(System.in);
        int t=in.nextInt();

        while(t-->0)
        {
            int a=in.nextInt(),b=in.nextInt();
            int s=0,l=0;
            if(a<b)
            {
                s=a;
                l=b;
            }
            else {
                s=b;
                l=a;
            }

            if(2*s-l<0)
            {
                int t=s;
                s=l;
                l=t;
            }
            int i=0;
            for(i=0;i<=l;i++)
            {
                if(2*s-l-i==0)
                break;
            }

            System.out.println((l+i)*(l+i));
        }
    }
}


import java.util.*;

public class Solution
{
    public static void main(String ar[])
    {
        Scanner in=new Scanner(System.in);
        int t=in.nextInt();

        while(t-->0)
        {
            int a=in.nextInt(),b=in.nextInt();
            int s=0;l=0;
            if(a<b)
            {
                s=a;
                l=b;
            }
            else {
                s=b;
                l=a;
            }

            int i=0;
            for(i=0;i<=l;i++)
            {
                if(2*s-l-i==0)
                break;
            }

            System.out.println((l+i)*(l+i));
        }
    }
}


import java.util.*;

public class Solution
{
    public static void main(String ar[])
    {
        Scanner in=new Scanner(System.in);
        int t=in.nextInt();

        while(t-->0)
        {
            int a=in.nextInt(),b=in.nextInt();
            int s=0,l=0;
            if(a<b)
            {
                s=a;
                l=b;
            }
            else {
                s=b;
                l=a;
            }

            if(2*s-l<0)
            {
                System.out.println(l*l);
            }
            else {
                int i=0;
                for(i=0;i<=l;i++)
                {
                    if(2*s-l-i==0)
                    break;
                }

                System.out.println((l+i)*(l+i));
            }
        }
    }
}


import java.util.*;

public class Solution
{
    public static void main(String ar[])
    {
        Scanner in=new Scanner(System.in);
        int t=in.nextInt();

        while(t-->0)
        {
            int a=in.nextInt(),b=in.nextInt();
            int s=0,l=0;
            if(a<b)
            {
                s=a;
                l=b;
            }
            else {
                s=b;
                l=a;
            }

            int i=0;
            for(i=0;i<=l;i++)
            {
                if(2*s-l-i==0)
                break;
            }

            System.out.println((l+i)*(l+i));
        }
    }
}


import java.util.*;

public class Solution
{
    public static void main(String ar[])
    {
        Scanner in=new Scanner(System.in)
        int t=in.nextInt();

        while(t-->0)
        {
            int a=in.nextInt(),b=in.nextInt();
            int s=0;l=0;
            if(a<b)
            {
                s=a;
                l=b;
            }
            else {
                s=b;
                l=a;
            }

            int i=0;
            for(i=0;i<=l;i++)
            {
                if(2*s-l-i==0)
                break;
            }

            System.out.println((l+i)*(l+i));
        }
    }
}


import java.util.Scanner;

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

		int t = input.nextInt();

		for (int i = 0; i < t; i++) {
			int a = input.nextInt();
			int b = input.nextInt();
			if (a == b) {
				System.out.println(a*b*4);
			} else {
				int num = 2 * a * b;
				for(int j=1; ;j++) {
					if (num <= j*j) {
						System.out.println(j*j);
						break;
					}
				}
			}
		}
		input.close();
	}
}


import java.util.ArrayList;
import java.util.Scanner;

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

		int t = input.nextInt();

		for (int i = 0; i < t; i++) {
			int a = input.nextInt();
			int b = input.nextInt();
			int num = 0;
			if (a >= b) {
				num = 2 * b;
				if(a>num)
					System.out.println(a*a);
				else
					System.out.println(num*num);
			}
			else {
				num = 2 * a;
				if(b>num)
					System.out.println(b*b);
				else
					System.out.println(num*num);
			}
		}
		input.close();
	}
}


import java.util.Scanner;

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

		int t = input.nextInt();

		for (int i = 0; i < t; i++) {
			long a = input.nextInt();
			long b = input.nextInt();
			if (a == b) {
				System.out.println(a*b*4);
			} else {
				long num = 2 * a * b;
				for(long j=1; ; j++) {
					if (num <= j*j) {
						System.out.println(j*j);
						break;
					}
				}
			}
		}
		input.close();
	}
}


import java.util.Scanner;

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

		int t = input.nextInt();

		for (int i = 0; i < t; i++) {
			int a = input.nextInt();
			int b = input.nextInt();
			if (a == b) {
				System.out.println(a*a*4);
			} else {
				int num1 = 2 * a;
				int num2 = 2 * b;

				if(num1<num2)
					System.out.println(num1*num1);
				else if(num1>num2)
					System.out.println(num2*num2);

			}
		}
		input.close();
	}
}


import java.util.Scanner;

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

		int t = input.nextInt();

		for (int i = 0; i < t; i++) {
			int a = input.nextInt();
			int b = input.nextInt();
			if (a == b) {
				System.out.println(a*b*4);
			} else {
				int num = 2 * a * b;
				for(int j=1;j<101; j++) {
					if (num <= j*j) {
						System.out.println(j*j);
						break;
					}
				}
			}
		}
		input.close();
	}
}


import java.util.Scanner;

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

		int t = input.nextInt();

		for (int i = 0; i < t; i++) {
			int a = input.nextInt();
			int b = input.nextInt();
			if (a == b) {
				System.out.println(a*a*4);
			} else {
				int num = 2 * a * b;
				int j = 0;
				int rectangle = 0;
				while (true) {
					rectangle = j * j;
					if (num <= rectangle) {
						System.out.println(rectangle);
						break;
					}
					j++;
				}
			}
		}
		input.close();
	}
}


import java.util.*;
public class Solution
{
    public static void main(String args[])
    {
        Scanner s=new Scanner(System.in);
        int t=s.nextInt();
        while(t-->0)
        {
            int a=s.nextInt();
            int b=s.nextInt();

            int ans=Math.min(a,(2*b));

            long res=(long)Math.pow(ans,2);
            System.out.println(res);
        }
    }
}


import java.util.*;
public class Solution
{
    public static void main(String args[])
    {
        Scanner s=new Scanner(System.in);
        int t=s.nextInt();
        while(t-->0)
        {
            HashMap<Integer,Integer> h=new HashMap<>();
            int n=s.nextInt();
            int a[]=new int[n];

            boolean flag=false;
            for(int i=0;i<n;i++)
        {
            int ele=s.nextInt();
            a[i]=ele;
            if(!h.containsKey(ele))
           {
             h.put(ele,1);
           }
            else
            {
                flag=true;
            }
        }
            if(flag)
            System.out.println("0");

            else if(n==2)
            System.out.println(a[1]-a[0]);
            else
            {

            Arrays.sort(a);

           System.out.println(a[1]-a[0]);
            }
        }}}


import java.util.*;
public class Solution
{
    public static void main(String args[])
    {
        Scanner s=new Scanner(System.in);
        int t=s.nextInt();
        while(t-->0)
        {
            int a=s.nextInt();
            int b=s.nextInt();

            int ans=Math.max(a,(2*b));

            long res=(long)Math.pow(ans,2);
            System.out.println(res);
        }
    }
}


import java.util.*;
public class Solution
{
    public static void main(String args[])
    {
        Scanner s=new Scanner(System.in);
        int t=s.nextInt();
        while(t-->0)
        {
            int a=s.nextInt();
            int b=s.nextInt();
            if(a==b)
            System.out.println((a+b)*(a+b));
            else
            {
            int min=Math.min(a,b);
            int max=Math.max(a,b);

            int ans=Math.max(max,(2*min));

            long res=(long)Math.pow(ans,2);
            System.out.println(res);
            }
        }
    }
}


import java.util.*;
public class Solution
{
    public static void main(String args[])
    {
        Scanner s=new Scanner(System.in);
        int t=s.nextInt();
        while(t-->0)
        {
            int a=s.nextInt();
            int b=s.nextInt();
            if(a==b)
            System.out.println((a+b)*(a+b));
            else
            {
            int ans=Math.max(a,(2*b));

            long res=(long)Math.pow(ans,2);
            System.out.println(res);
            }
        }
    }
}


import java.io.*;

public class MaximalSquare{

    public static void main(String[] args){

      BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
      try{
         int cases = Integer.parseInt(br.readLine());
         String[] temp = new String[2];
         while(cases-->0){
           temp = br.readLine().split("\\s+");
           int l = Integer.parseInt(temp[0]);
           int b = Integer.parseInt(temp[1]);
           if(l==b){
             System.out.println((2*l) * (2*l));
             continue;
           }else if(l > b && l > (2*b)){
             System.out.println(l*l);
             continue;
           }else if(l > b && l < (2*b)){
             System.out.println((2*b) * (2*b));
             continue;
           }else if(b > l && b > (2*l)){
             System.out.println(b*b);
             continue;
           }else if(b > l && b < (2*l)){
             System.out.println((2*l) * (2*l));
             continue;
           }
         }
      }catch(IOException ioe){
        ioe.printStackTrace();
      }
    }
}


import java.io.*;

public class MaximalSquare{

    public static void main(String[] args){

      BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
      try{
         int cases = Integer.parseInt(br.readLine());
         String[] temp = new String[2];
         while(cases-->0){
           temp = br.readLine().split("\\s+");
           int l = Integer.parseInt(temp[0]);
           int b = Integer.parseInt(temp[1]);
           if(l==b){
             System.out.println((2*l) * (2*l));
             continue;
           }else if(l > b && l >= (2*b)){
             System.out.println(l*l);
             continue;
           }else if(l > b && l < (2*b)){
             System.out.println((2*b) * (2*b));
             continue;
           }else if(b > l && b >= (2*l)){
             System.out.println(b*b);
             continue;
           }else if(b > l && b < (2*l)){
             System.out.println((2*l) * (2*l));
             continue;
           }
         }
      }catch(IOException ioe){
        ioe.printStackTrace();
      }
    }
}


import java.util.*;
import java.lang.*;
import java.io.*;
public class Mm
{
	public static void main(String args[])
	{
		Scanner obj= new Scanner(System.in);
		long t=obj.nextLong();
		while(t>0)
		{
			long a=obj.nextLong();
			long b=obj.nextLong();
			long ans;
			if(a>b)
			{
				if(2*b>a)
				{
					ans= 4*b*b;
				}
				else
				{
					ans=a*a;
				}
			}
			else if(a==b)
			{
				ans= 4*a*a;
			}
			else
			{
				if(2*a>b)
				{
					ans= 4*a*a;
				}
				else
				{
					ans=b*b;
				}
			}
			System.out.println(ans);

		}
	}
}


import java.util.*;
import java.lang.*;
import java.io.*;
public class mai
{
	public static void main(String args[])
	{
		B b1= new B();
		C c1= new C();

		Scanner obj= new Scanner(System.in);
		long t=obj.nextLong();
		while(t>0)
		{
			long a=obj.nextLong();
			long b=obj.nextLong();
			long ans;
			if(a>b)
			{
				if(2*b>a)
				{
					ans= 4*b*b;
				}
				else
				{
					ans=a*a;
				}
			}
			else if(a==b)
			{
				ans= 4*a*a;
			}
			else
			{
				if(2*a>b)
				{
					ans= 4*a*a;
				}
				else
				{
					ans=b*b;
				}
			}
			System.out.println(ans);

		}
	}
}

class C
{
	long n1,n2;
	long find_lcm()
	{
	 long lcm = (n1 > n2) ? n1 : n2;

        while(true)
        {
            if( lcm % n1 == 0 && lcm % n2 == 0 )
            {
                break;
            }
            lcm++;
        }
        return lcm;
	}
}


import java.util.*;
import java.lang.*;
import java.io.*;
public class Mm
{
	public static void main(String args[])
	{
		Scanner obj= new Scanner(System.in);
		C c1= new C();
		long t=obj.nextLong();
		while(t>0)
		{
			long a=obj.nextLong();
			long b=obj.nextLong();
			long ans;
			if(b>a)
			{
				c1.a=a;
				c1.b=b;
				ans=c1.area();
			}
			else if(a==b)
			{
				ans= 4*a*a;
			}
			else
			{
				c1.a=b;
				c1.b=a;
				ans=c1.area();

			}

			System.out.println(ans);
			t--;
		}
	}
}

class C
{
	long a,b,ans;
	long area()
	{
				if(2*a>b)
				{
					ans= 4*a*a;
				}
				else
				{
					ans=b*b;
				}
	return ans;
	}
}


import java.util.*;
import java.lang.*;
import java.io.*;
public class Mm
{
	public static void main(String args[])
	{
		Scanner obj= new Scanner(System.in);
		C c1= new C();
		long t=obj.nextLong();
		while(t>0)
		{
			long a=obj.nextLong();
			long b=obj.nextLong();
			long ans;
			if(b>a)
			{
				c1.a=a;
				c1.b=b;
				ans=c1.area();
			}
			else if(a==b)
			{
				ans= 4*a*a;
			}
			else
			{
				c1.a=b;
				c1.b=a;
				ans=c1.area();

			}

			System.out.println(ans);

		}
	}
}

class C
{
	long a,b,ans;
	long area()
	{
				if(2*a>b)
				{
					ans= 4*a*a;
				}
				else
				{
					ans=b*b;
				}
	return ans;
	}
}


import java.util.*;
import java.lang.*;
import java.io.*;
public class great
{
	public static void main(String args[])
	{
		B b1= new B();
		C c1= new C();

		Scanner obj= new Scanner(System.in);
		long t=obj.nextLong();
		while(t>0)
		{
			long a=obj.nextLong();
			long b=obj.nextLong();
			long ans;
			if(a>b)
			{
				if(2*b>a)
				{
					ans= 4*b*b;
				}
				else
				{
					ans=a*a;
				}
			}
			else if(a==b)
			{
				ans= 4*a*a;
			}
			else
			{
				if(2*a>b)
				{
					ans= 4*a*a;
				}
				else
				{
					ans=b*b;
				}
			}
			System.out.println(ans);

		}
	}
}

class C
{
	long n1,n2;
	long find_lcm()
	{
	 long lcm = (n1 > n2) ? n1 : n2;

        while(true)
        {
            if( lcm % n1 == 0 && lcm % n2 == 0 )
            {
                break;
            }
            lcm++;
        }
        return lcm;
	}
}


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

public class MinimalSquare644A{
	static class FastReader {

        BufferedReader br;
        StringTokenizer st;

        private FastReader() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }

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

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

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

	int[] nextIntArrayOne(int n) {
				int[] a = new int[n+1];
				for (int i = 1; i < n+1; i++)
					a[i] = nextInt();
				return a;
	}

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

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

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

	public static void main(String[] args) {
		FastReader s =new FastReader();
		int t = s.nextInt();
		StringBuilder str = new StringBuilder();
		while(t-- >0) {
			int a = s.nextInt();
			int b = s.nextInt();
			int x = Math.min(a + a, b + b);
			if(a !=b && (a == 1 || b == 1)) {
				int z = Math.max(a, b);
				str.append(z * z).append("\n");
			}else
			str.append(x * x).append("\n");

		}
		System.out.println(str);
	}

}


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

public class MinimalSquare644A{
	static class FastReader {

        BufferedReader br;
        StringTokenizer st;

        private FastReader() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }

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

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

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

	int[] nextIntArrayOne(int n) {
				int[] a = new int[n+1];
				for (int i = 1; i < n+1; i++)
					a[i] = nextInt();
				return a;
	}

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

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

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

	public static void main(String[] args) {
		FastReader s =new FastReader();
		int t = s.nextInt();
		StringBuilder str = new StringBuilder();
		while(t-- >0) {
			int a = s.nextInt();
			int b = s.nextInt();
			int x = Math.min(a + a, b + b);
			x = Math.max(a, x);
			x = Math.max(x, b);

			str.append(x * x).append("\n");

		}
		System.out.println(str);
	}

}


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

public class MinimalSquare644A{
	static class FastReader {

        BufferedReader br;
        StringTokenizer st;

        private FastReader() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }

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

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

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

	int[] nextIntArrayOne(int n) {
				int[] a = new int[n+1];
				for (int i = 1; i < n+1; i++)
					a[i] = nextInt();
				return a;
	}

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

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

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

	public static void main(String[] args) {
		FastReader s =new FastReader();
		int t = s.nextInt();
		StringBuilder str = new StringBuilder();
		while(t-- >0) {
			int a = s.nextInt();
			int b = s.nextInt();
			int x = Math.min(a + a, b + b);
			if(a !=b && (a == 1 || b == 1)) {
				int z = Math.max(a, b);
				str.append(z * z).append("\n");
			}
			str.append(x * x).append("\n");

		}
		System.out.println(str);
	}

}


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

public class MinimalSquare {
  public static void main(String[] args) {
    InputReader in = new InputReader(System.in);
    OutputWriter out = new OutputWriter(System.out);
    int t = in.readInt();
    while (t-- > 0) {
      int a = in.readInt();
      int b = in.readInt();
      out.printLine(check(a, b));
    }
  }

  private static int check(int a, int b) {
    int min = Math.min(a, b);
    int max = Math.max(a, b);
    min *= 2;
    // System.out.println(min + "" + max);
    int diff = min - max;
    max += diff;
    return max * min;
  }

}
// Check Prime :

// private static boolean isPrime(int n) {
// if (n < 2)
// return false;
// for (int i = 2; i <= Math.sqrt(n); i++) {
// if (n % i == 0)
// return false;
// }
// return true;
// }

// GCD :

// private static int gcd(int a, int b) {
// return b == 0 ? a : gcd(b, a % b);
// }

// Sieve :

// private static void sieve() {
// boolean primes[] = new boolean[maxN + 1];
// for (int i = 0; i <= N; i++)
// primes[i] = true;
// primes[0] = false;
// primes[1] = false;

// for (int i = 2; i * i <= maxN; i++) {
// if (primes[i]) {
// for (int j = i * i; j <= maxN; j += i)
// primes[j] = false;
// }
// }

// }

// Fast Exponentiation:

// private static int exponent(int a, int n, int p) {
// int res = 1;
// a = a % p;
// if (a == 0)
// return 0;
// while (n > 0) {
// if ((n & 1) == 1) {
// res = (res * a) % p;
// }
// a = (a * a) % p;
// n >>= 1;
// }

// }

// Factorize :

// private static void factorize(int n) {
// for (int i = 2; i <= Math.sqrt(n); i++) {
// if (n % i == 0) {
// int count = 0;
// while (n % i == 0) {
// count++;
// n = n / i;
// }
// }
// }
// if (n != 1)
// System.out.println(1);
// }

// Product of Factors:

// private static int product(int n) {
// {
// int num = nFactors(n)/2;
// int res=exponent(n,num,mod);
// }

// Number of Factors :

// private static int nFactors(int n) {
// int res = 1;
// for (int i = 2; i <= Math.sqrt(n); i++) {
// if (n % i == 0) {
// int count = 0;
// while (n % i == 0) {
// count++;
// n = n / i;
// }
// res *= (count + 1);
// }
// }
// if (n != 1)
// res *= 2;

// return res;
// }

class InputReader {
  private InputStream stream;
  private byte[] buf = new byte[1024];
  private int curChar;
  private int numChars;
  private SpaceCharFilter filter;

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

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

  public int readInt() {
    int c = read();
    while (isSpaceChar(c)) {
      c = read();
    }
    int sgn = 1;
    if (c == '-') {
      sgn = -1;
      c = read();
    }
    int res = 0;
    do {
      if (c < '0' || c > '9') {
        throw new InputMismatchException();
      }
      res *= 10;
      res += c - '0';
      c = read();
    } while (!isSpaceChar(c));
    return res * sgn;
  }

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

  public double readDouble() {
    int c = read();
    while (isSpaceChar(c)) {
      c = read();
    }
    int sgn = 1;
    if (c == '-') {
      sgn = -1;
      c = read();
    }
    double res = 0;
    while (!isSpaceChar(c) && c != '.') {
      if (c == 'e' || c == 'E') {
        return res * Math.pow(10, readInt());
      }
      if (c < '0' || c > '9') {
        throw new InputMismatchException();
      }
      res *= 10;
      res += c - '0';
      c = read();
    }
    if (c == '.') {
      c = read();
      double m = 1;
      while (!isSpaceChar(c)) {
        if (c == 'e' || c == 'E') {
          return res * Math.pow(10, readInt());
        }
        if (c < '0' || c > '9') {
          throw new InputMismatchException();
        }
        m /= 10;
        res += (c - '0') * m;
        c = read();
      }
    }
    return res * sgn;
  }

  public long readLong() {
    int c = read();
    while (isSpaceChar(c)) {
      c = read();
    }
    int sgn = 1;
    if (c == '-') {
      sgn = -1;
      c = read();
    }
    long res = 0;
    do {
      if (c < '0' || c > '9') {
        throw new InputMismatchException();
      }
      res *= 10;
      res += c - '0';
      c = read();
    } while (!isSpaceChar(c));
    return res * sgn;
  }

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

  public String next() {
    return readString();
  }

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

class OutputWriter {
  private final PrintWriter writer;

  public OutputWriter(OutputStream outputStream) {
    writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));
  }

  public OutputWriter(Writer writer) {
    this.writer = new PrintWriter(writer);
  }

  public void print(Object... objects) {
    for (int i = 0; i < objects.length; i++) {
      if (i != 0) {
        writer.print(' ');
      }
      writer.print(objects[i]);
    }
    writer.flush();
  }

  public void printLine(Object... objects) {
    print(objects);
    writer.println();
    writer.flush();
  }

  public void close() {
    writer.close();
  }

  public void flush() {
    writer.flush();
  }
}


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

public class MinimalSquare {
  public static void main(String[] args) {
    InputReader in = new InputReader(System.in);
    OutputWriter out = new OutputWriter(System.out);
    int t = in.readInt();
    while (t-- > 0) {
      int a = in.readInt();
      int b = in.readInt();
      out.printLine(check(a, b));
    }
  }

  private static int check(int a, int b) {
    int min = Math.min(a, b);
    int max = Math.max(a, b);
    if (max == min)
      return max * min * 4;
    else {
      min *= 2;

      if (max % min == 0)
        return (max * min);

      else {
        int res1 = Math.min(max, min);
        int res2 = Math.max(max, min);
        return ((res1 + 1) * res2);
      }
    }

  }
}
// Check Prime :

// private static boolean isPrime(int n) {
// if (n < 2)
// return false;
// for (int i = 2; i <= Math.sqrt(n); i++) {
// if (n % i == 0)
// return false;
// }
// return true;
// }

// GCD :

// private static int gcd(int a, int b) {
// return b == 0 ? a : gcd(b, a % b);
// }

// Sieve :

// private static void sieve() {
// boolean primes[] = new boolean[maxN + 1];
// for (int i = 0; i <= N; i++)
// primes[i] = true;
// primes[0] = false;
// primes[1] = false;

// for (int i = 2; i * i <= maxN; i++) {
// if (primes[i]) {
// for (int j = i * i; j <= maxN; j += i)
// primes[j] = false;
// }
// }

// }

// Fast Exponentiation:

// private static int exponent(int a, int n, int p) {
// int res = 1;
// a = a % p;
// if (a == 0)
// return 0;
// while (n > 0) {
// if ((n & 1) == 1) {
// res = (res * a) % p;
// }
// a = (a * a) % p;
// n >>= 1;
// }

// }

// Factorize :

// private static void factorize(int n) {
// for (int i = 2; i <= Math.sqrt(n); i++) {
// if (n % i == 0) {
// int count = 0;
// while (n % i == 0) {
// count++;
// n = n / i;
// }
// }
// }
// if (n != 1)
// System.out.println(1);
// }

// Product of Factors:

// private static int product(int n) {
// {
// int num = nFactors(n)/2;
// int res=exponent(n,num,mod);
// }

// Number of Factors :

// private static int nFactors(int n) {
// int res = 1;
// for (int i = 2; i <= Math.sqrt(n); i++) {
// if (n % i == 0) {
// int count = 0;
// while (n % i == 0) {
// count++;
// n = n / i;
// }
// res *= (count + 1);
// }
// }
// if (n != 1)
// res *= 2;

// return res;
// }

class InputReader {
  private InputStream stream;
  private byte[] buf = new byte[1024];
  private int curChar;
  private int numChars;
  private SpaceCharFilter filter;

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

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

  public int readInt() {
    int c = read();
    while (isSpaceChar(c)) {
      c = read();
    }
    int sgn = 1;
    if (c == '-') {
      sgn = -1;
      c = read();
    }
    int res = 0;
    do {
      if (c < '0' || c > '9') {
        throw new InputMismatchException();
      }
      res *= 10;
      res += c - '0';
      c = read();
    } while (!isSpaceChar(c));
    return res * sgn;
  }

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

  public double readDouble() {
    int c = read();
    while (isSpaceChar(c)) {
      c = read();
    }
    int sgn = 1;
    if (c == '-') {
      sgn = -1;
      c = read();
    }
    double res = 0;
    while (!isSpaceChar(c) && c != '.') {
      if (c == 'e' || c == 'E') {
        return res * Math.pow(10, readInt());
      }
      if (c < '0' || c > '9') {
        throw new InputMismatchException();
      }
      res *= 10;
      res += c - '0';
      c = read();
    }
    if (c == '.') {
      c = read();
      double m = 1;
      while (!isSpaceChar(c)) {
        if (c == 'e' || c == 'E') {
          return res * Math.pow(10, readInt());
        }
        if (c < '0' || c > '9') {
          throw new InputMismatchException();
        }
        m /= 10;
        res += (c - '0') * m;
        c = read();
      }
    }
    return res * sgn;
  }

  public long readLong() {
    int c = read();
    while (isSpaceChar(c)) {
      c = read();
    }
    int sgn = 1;
    if (c == '-') {
      sgn = -1;
      c = read();
    }
    long res = 0;
    do {
      if (c < '0' || c > '9') {
        throw new InputMismatchException();
      }
      res *= 10;
      res += c - '0';
      c = read();
    } while (!isSpaceChar(c));
    return res * sgn;
  }

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

  public String next() {
    return readString();
  }

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

class OutputWriter {
  private final PrintWriter writer;

  public OutputWriter(OutputStream outputStream) {
    writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));
  }

  public OutputWriter(Writer writer) {
    this.writer = new PrintWriter(writer);
  }

  public void print(Object... objects) {
    for (int i = 0; i < objects.length; i++) {
      if (i != 0) {
        writer.print(' ');
      }
      writer.print(objects[i]);
    }
    writer.flush();
  }

  public void printLine(Object... objects) {
    print(objects);
    writer.println();
    writer.flush();
  }

  public void close() {
    writer.close();
  }

  public void flush() {
    writer.flush();
  }
}


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

public class MinimalSquare {
  public static void main(String[] args) {
    InputReader in = new InputReader(System.in);
    OutputWriter out = new OutputWriter(System.out);
    int t = in.readInt();
    while (t-- > 0) {
      int a = in.readInt();
      int b = in.readInt();
      out.printLine(check(a, b));
    }
  }

  private static int check(int a, int b) {
    int min = Math.min(a, b);
    int max = Math.max(a, b);
    min *= 2;
    int smin = Math.min(min, max);
    int smax = Math.max(min, max);
    // System.out.println(min + "" + max);
    int diff = smax - smin;
    smin += diff;
    return smax * smin;
  }

}
// Check Prime :

// private static boolean isPrime(int n) {
// if (n < 2)
// return false;
// for (int i = 2; i <= Math.sqrt(n); i++) {
// if (n % i == 0)
// return false;
// }
// return true;
// }

// GCD :

// private static int gcd(int a, int b) {
// return b == 0 ? a : gcd(b, a % b);
// }

// Sieve :

// private static void sieve() {
// boolean primes[] = new boolean[maxN + 1];
// for (int i = 0; i <= N; i++)
// primes[i] = true;
// primes[0] = false;
// primes[1] = false;

// for (int i = 2; i * i <= maxN; i++) {
// if (primes[i]) {
// for (int j = i * i; j <= maxN; j += i)
// primes[j] = false;
// }
// }

// }

// Fast Exponentiation:

// private static int exponent(int a, int n, int p) {
// int res = 1;
// a = a % p;
// if (a == 0)
// return 0;
// while (n > 0) {
// if ((n & 1) == 1) {
// res = (res * a) % p;
// }
// a = (a * a) % p;
// n >>= 1;
// }

// }

// Factorize :

// private static void factorize(int n) {
// for (int i = 2; i <= Math.sqrt(n); i++) {
// if (n % i == 0) {
// int count = 0;
// while (n % i == 0) {
// count++;
// n = n / i;
// }
// }
// }
// if (n != 1)
// System.out.println(1);
// }

// Product of Factors:

// private static int product(int n) {
// {
// int num = nFactors(n)/2;
// int res=exponent(n,num,mod);
// }

// Number of Factors :

// private static int nFactors(int n) {
// int res = 1;
// for (int i = 2; i <= Math.sqrt(n); i++) {
// if (n % i == 0) {
// int count = 0;
// while (n % i == 0) {
// count++;
// n = n / i;
// }
// res *= (count + 1);
// }
// }
// if (n != 1)
// res *= 2;

// return res;
// }

class InputReader {
  private InputStream stream;
  private byte[] buf = new byte[1024];
  private int curChar;
  private int numChars;
  private SpaceCharFilter filter;

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

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

  public int readInt() {
    int c = read();
    while (isSpaceChar(c)) {
      c = read();
    }
    int sgn = 1;
    if (c == '-') {
      sgn = -1;
      c = read();
    }
    int res = 0;
    do {
      if (c < '0' || c > '9') {
        throw new InputMismatchException();
      }
      res *= 10;
      res += c - '0';
      c = read();
    } while (!isSpaceChar(c));
    return res * sgn;
  }

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

  public double readDouble() {
    int c = read();
    while (isSpaceChar(c)) {
      c = read();
    }
    int sgn = 1;
    if (c == '-') {
      sgn = -1;
      c = read();
    }
    double res = 0;
    while (!isSpaceChar(c) && c != '.') {
      if (c == 'e' || c == 'E') {
        return res * Math.pow(10, readInt());
      }
      if (c < '0' || c > '9') {
        throw new InputMismatchException();
      }
      res *= 10;
      res += c - '0';
      c = read();
    }
    if (c == '.') {
      c = read();
      double m = 1;
      while (!isSpaceChar(c)) {
        if (c == 'e' || c == 'E') {
          return res * Math.pow(10, readInt());
        }
        if (c < '0' || c > '9') {
          throw new InputMismatchException();
        }
        m /= 10;
        res += (c - '0') * m;
        c = read();
      }
    }
    return res * sgn;
  }

  public long readLong() {
    int c = read();
    while (isSpaceChar(c)) {
      c = read();
    }
    int sgn = 1;
    if (c == '-') {
      sgn = -1;
      c = read();
    }
    long res = 0;
    do {
      if (c < '0' || c > '9') {
        throw new InputMismatchException();
      }
      res *= 10;
      res += c - '0';
      c = read();
    } while (!isSpaceChar(c));
    return res * sgn;
  }

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

  public String next() {
    return readString();
  }

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

class OutputWriter {
  private final PrintWriter writer;

  public OutputWriter(OutputStream outputStream) {
    writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));
  }

  public OutputWriter(Writer writer) {
    this.writer = new PrintWriter(writer);
  }

  public void print(Object... objects) {
    for (int i = 0; i < objects.length; i++) {
      if (i != 0) {
        writer.print(' ');
      }
      writer.print(objects[i]);
    }
    writer.flush();
  }

  public void printLine(Object... objects) {
    print(objects);
    writer.println();
    writer.flush();
  }

  public void close() {
    writer.close();
  }

  public void flush() {
    writer.flush();
  }
}


import java.util.Scanner;

public class Main {

	public static void main(String[] args)
	{
		Scanner scanner = new Scanner(System.in);
		int t = scanner.nextInt();
		int a,b;
		int j=0;
		while(j<t){
		    a = scanner.nextInt();
		    b = scanner.nextInt();
		    if(a>b){
		        if(a>=b*2) System.out.println(a*a);
		        else System.out.println((a+1)*(a+1));
		    }
		    else if (b>a) {
		        if(b>=a*2) System.out.println(b*b);
		        else System.out.println((b+1)*(b+1));
		    }
		    else System.out.println(a*a*4);
		    j++;
		}
		scanner.close();
	}

}


import java.util.Scanner;
import java.lang.Math;

public class Main {

	public static void main(String[] args)
	{
		Scanner scanner = new Scanner(System.in);
		int t = scanner.nextInt();
		int a,b;
		int j=0;
		while(j<t){
		    a = scanner.nextInt();
		    b = scanner.nextInt();
		    if(a==b) System.out.println(a*b*4);
		    else if(a!=1 && b!=1){
		        if(a>b){
		            if (a%2==0) System.out.println((int)Math.pow(a,2));
		            else System.out.println((int)Math.pow(a+1,2));
		        }
		        else {
		            if (b%2==0) System.out.println((int)Math.pow(b,2));
		            else System.out.println((int)Math.pow(b+1,2));
		        }
		    }
		    else {
		        if(a==1) {
		                System.out.println((int)Math.pow(b,2));
		        }
		        else {
		                 System.out.println((int)Math.pow(a,2));
		        }
		    }
		    j++;
		}
		scanner.close();
	}

}


import java.util.Scanner;

public class Main {

	public static void main(String[] args)
	{
		Scanner scanner = new Scanner(System.in);
		int t = scanner.nextInt();
		int a,b;
		int j=0;
		while(j<t){
		    a = scanner.nextInt();
		    b = scanner.nextInt();
		    if(a>b){
		        if(a>=b+b) System.out.println(a*a);
		        else System.out.println((a+1)*(a+1));
		    }
		    else if (b>a) {
		        if(b>=a+a) System.out.println(b*b);
		        else System.out.println((b+1)*(b+1));
		    }
		    else System.out.println(a*a*4);
		    j++;
		}
		scanner.close();
	}

}


import java.util.Scanner;

public class Main {

	public static void main(String[] args)
	{
		Scanner scanner = new Scanner(System.in);
		int t = scanner.nextInt();
		int a,b;
		int j=0;
		while(j<t){
		    a = scanner.nextInt();
		    b = scanner.nextInt();
		    if(a>b){
		        if(a%b==0) System.out.println(a*a);
		        else System.out.println((a+1)*(a+1));
		    }
		    else if (b>a) {
		        if(b%a==0) System.out.println(b*b);
		        else System.out.println((b+1)*(b+1));
		    }
		    else System.out.println(a*a*4);
		    j++;
		}
		scanner.close();
	}

}


import java.util.Scanner;
import java.lang.Math;

public class Main {

	public static void main(String[] args)
	{
		Scanner scanner = new Scanner(System.in);
		int t = scanner.nextInt();
		int a,b;
		int j=0;
		while(j<t){
		    a = scanner.nextInt();
		    b = scanner.nextInt();
		    if(a==b) System.out.println(a*b*4);
		    else if(a==1 && b==1) System.out.println("4");
		    else if(a!=1 && b!=1){
		        if(a>b){
		            if (a%2==0) System.out.println((int)Math.pow(a,2));
		            else System.out.println((int)Math.pow(a+1,2));
		        }
		        else {
		            if (b%2==0) System.out.println((int)Math.pow(b,2));
		            else System.out.println((int)Math.pow(b+1,2));
		        }
		    }
		    else {
		        if(a==1) {
		                System.out.println((int)Math.pow(b,2));
		        }
		        else {
		                 System.out.println((int)Math.pow(a,2));
		        }
		    }
		    j++;
		}
		scanner.close();
	}

}


import java.util.Scanner;

public class Main {

	public static void main(String[] args)
	{
		Scanner scanner = new Scanner(System.in);
		int t = scanner.nextInt();
		int a,b;
		int j=0;
		while(j<t){
		    a = scanner.nextInt();
		    b = scanner.nextInt();
		    if(a>b){
		        if(a>=b*b) System.out.println(a*a);
		        else System.out.println((a+1)*(a+1));
		    }
		    else if (b>a) {
		        if(b>=a*a) System.out.println(b*b);
		        else System.out.println((b+1)*(b+1));
		    }
		    else System.out.println(a*a*4);
		    j++;
		}
		scanner.close();
	}

}


import java.util.Scanner;

public class Main {

	public static void main(String[] args)
	{
		Scanner scanner = new Scanner(System.in);
		int t = scanner.nextInt();
		int a,b;
		int j=0;
		while(j<t){
		    a = scanner.nextInt();
		    b = scanner.nextInt();
		    if(a>b){
		        if(a>=b*2) System.out.println(a*a);
		        else System.out.println((b*2)*(b*2));
		    }
		    else if (b>a) {
		        if(b>=a*2) System.out.println(b*b);
		        else System.out.println((a*2)*(a*2));
		    }
		    else System.out.println(a*a*4);
		    j++;
		}
		scanner.close();
	}

}


import java.util.Scanner;

public class Main {

	public static void main(String[] args)
	{
		Scanner scanner = new Scanner(System.in);
		int t = scanner.nextInt();
		int a,b;
		int j=0;
		while(j<t){
		    a = scanner.nextInt();
		    b = scanner.nextInt();
		    if(a>b){
		        if(a>=b*2) System.out.println(a*a);
		        else System.out.println(b*b);
		    }
		    else if (b>a) {
		        if(b>=a*2) System.out.println(b*b);
		        else System.out.println(a*a);
		    }
		    else System.out.println(a*a*4);
		    j++;
		}
		scanner.close();
	}

}


import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;

public class AntonAndPolyHedrons {

	public static void main(String[] args) throws NumberFormatException, IOException {
		// TODO Auto-generated method stub
		/*
		    String[] str=br.readLine().split(" ");
		    for(int i=0;i<n;i++)
		        arr[i]=Integer.parseInt(str[i]);
		    int n=Integer.parseInt(str[0]);

		*/
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
        BufferedWriter bw=new BufferedWriter(new OutputStreamWriter(System.out));
        int t=Integer.parseInt(br.readLine());

        while(t-->0)
        {
        	String[] str=br.readLine().split(" ");
        	 int n=Integer.parseInt(str[0]);
        	  int m=Integer.parseInt(str[1]);
        	  int ar=2*n*m;
        	  if(n==m)
        	    {
        	        bw.write((n+m)*(n+m)+"\n");
        	        continue;
        	    }
        	  for(int i=2*Math.min(n,m);i<=2*Math.max(n,m);i++){
        	      if(ar<=i*i){
        	          if(i>=Math.max(n,m))
        	            {
        	                bw.write(i*i+"\n");
        	                break;
        	            }
        	      }
        	  }
        	  //bw.write(ar+"\n");
        }
        //bw.write(+"\n");
        bw.flush();
	}

}


import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;

public class AntonAndPolyHedrons {

	public static void main(String[] args) throws NumberFormatException, IOException {
		// TODO Auto-generated method stub
		/*
		    String[] str=br.readLine().split(" ");
		    for(int i=0;i<n;i++)
		        arr[i]=Integer.parseInt(str[i]);
		    int n=Integer.parseInt(str[0]);

		*/
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
        BufferedWriter bw=new BufferedWriter(new OutputStreamWriter(System.out));
        int t=Integer.parseInt(br.readLine());
        boolean[] arr=new boolean[40001];
        for(int i=1;i<=200;i++)
            arr[i*i]=true;
        while(t-->0)
        {
        	String[] str=br.readLine().split(" ");
        	 int n=Integer.parseInt(str[0]);
        	  int m=Integer.parseInt(str[1]);
        	  int ar=2*n*m;
        	  if(n==m)
        	    {
        	        bw.write((n+m)*(n+m)+"\n");
        	        continue;
        	    }
        	  while(!arr[ar]){
        	      ar++;
        	  }
        	  bw.write(ar+"\n");
        }
        //bw.write(+"\n");
        bw.flush();
	}

}


import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;

public class AntonAndPolyHedrons {

	public static void main(String[] args) throws NumberFormatException, IOException {
		// TODO Auto-generated method stub
		/*
		    String[] str=br.readLine().split(" ");
		    for(int i=0;i<n;i++)
		        arr[i]=Integer.parseInt(str[i]);
		    int n=Integer.parseInt(str[0]);

		*/
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
        BufferedWriter bw=new BufferedWriter(new OutputStreamWriter(System.out));
        int t=Integer.parseInt(br.readLine());

        while(t-->0)
        {
        	String[] str=br.readLine().split(" ");
        	 int n=Integer.parseInt(str[0]);
        	  int m=Integer.parseInt(str[1]);
        	  int ar=2*n*m;
        	  if(n==m)
        	    {
        	        bw.write((n+m)*(n+m)+"\n");
        	        continue;
        	    }
        	  for(int i=2*Math.min(n,m);i<=2*Math.max(n,m);i++){
        	      if(ar<=i*i){
        	          bw.write(i*i+"\n");
        	          break;
        	      }
        	  }
        	  //bw.write(ar+"\n");
        }
        //bw.write(+"\n");
        bw.flush();
	}

}


import java.util.*;
public class sol
{
    public static void main(String ar[])
    {
        Scanner scan=new Scanner(System.in);
        int test=scan.nextInt();
        while(test-->0)
        {
            int a=scan.nextInt();
            int b=scan.nextInt();
            if((2*b)*(2*b)>=a)
                System.out.println(4*b*b);
            else
                System.out.println(a*a);
        }
    }
}


import java.util.*;
public class sol
{
    public static void main(String ar[])
    {
        Scanner scan=new Scanner(System.in);
        int test=scan.nextInt();
        while(test-->0)
        {
            int a=scan.nextInt();
            int b=scan.nextInt();
            if(2*a>=b&& 2*b>=a)
                System.out.println(Math.min(4*a*a,4*b*b);
            if(2*a>=b&& 2*b>=a)
                System.out.println(Math.min(4*a*a,4*b*b));
            else if(2*a>=b)
                {
                	if(a>=b)
                		System.out.println(a*a);
                	else
                		System.out.println(4*a*a);
                }
            else
                {
                	if(b>=a)
                		System.out.println(b*b);
                	else
                		System.out.println(4*b*b);
                }
        }
    }
}


import java.util.*;
public class sol
{
    public static void main(String ar[])
    {
        Scanner scan=new Scanner(System.in);
        int test=scan.nextInt();
        while(test-->0)
        {
            int a=scan.nextInt();
            int b=scan.nextInt();
            if(a>2*b)
                System.out.println(a*a);
            else
                System.out.println(4*b*b);
        }
    }
}


import java.util.*;
public class sol
{
    public static void main(String ar[])
    {
        Scanner scan=new Scanner(System.in);
        int test=scan.nextInt();
        while(test-->0)
        {
            int a=scan.nextInt();
            int b=scan.nextInt();
            if((2*b)>=a)
                System.out.println(4*b*b);
            else
                System.out.println(a*a);
        }
    }
}


import java.util.*;
public class sol
{
    public static void main(String ar[])
    {
        Scanner scan=new Scanner(System.in);
        int test=scan.nextInt();
        while(test-->0)
        {
            int a=scan.nextInt();
            int b=scan.nextInt();
            if(2*a>=b)
                System.out.println(a*a);
            else
                System.out.println(4*b*b);
        }
    }
}


import java.util.*;
public class sol
{
    public static void main(String ar[])
    {
        Scanner scan=new Scanner(System.in);
        int test=scan.nextInt();
        while(test-->0)
        {
            int a=scan.nextInt();
            int b=scan.nextInt();

            if(2*a>=b&& 2*b>=a)
                System.out.println(Math.min(4*a*a,4*b*b));
            else if(2*a>=b)
                {
                	if(a>=b)
                		System.out.println(a*a);
                	else
                		System.out.println(4*a*a);
                }
            else
                {
                	if(b>=a)
                		System.out.println(b*b);
                	else
                		System.out.println(4*b*b);
                }
        }
    }
}


import java.util.*;
public class sol
{
    public static void main(String ar[])
    {
        Scanner scan=new Scanner(System.in);
        int test=scan.nextInt();
        while(test-->0)
        {
            int a=scan.nextInt();
            int b=scan.nextInt();
            if(a>2*b
                System.out.println(a*a);
            else
                System.out.println(4*b*b);
        }
    }
}


import java.io.*;
import java.math.*;
import java.security.*;
import java.text.*;
import java.time.LocalTime;
import java.util.*;
import java.util.concurrent.*;
import java.util.regex.*;
import java.math.*;

public class A {

    public static void main(String[] args) {

    	FastScanner scan = new FastScanner();

    	int t = scan.nextInt();
    	for(int tt=0; tt<t; tt++) {
    		int a = scan.nextInt(), b = scan.nextInt();
    		if(a > b) {
    			int temp = a;
    			a = b;
    			b = temp;
    		}
    		long side = Math.max(a*2, b);
    		System.out.println(side * side);
     	}

    }

    public static void sort(int [] a) {
    	ArrayList<Integer> b = new ArrayList<>();
    	for(int i: a) b.add(i);
    	Collections.sort(b);
    	for(int i=0; i<a.length; i++) a[i]= b.get(i);
    }

    static class FastScanner{

    	BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    	StringTokenizer st = new StringTokenizer("");
    	String next() {
    		while(!st.hasMoreTokens())
    			try {
    				st = new StringTokenizer(br.readLine());
    			} catch (IOException e){
    				e.printStackTrace();
    			}
    		return st.nextToken();
    	}

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

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

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

    }

}


import java.io.*;
import java.math.*;
import java.security.*;
import java.text.*;
import java.time.LocalTime;
import java.util.*;
import java.util.concurrent.*;
import java.util.regex.*;

public class Main {

    public static void main(String[] args) {

    	FastScanner scan = new FastScanner();

    	int t = scan.nextInt();

    	for(int tt=0; tt<t; tt++) {
    		long a = scan.nextInt(), b = scan.nextInt();
    		if(a > b) {
    			long temp = b;
    			b = a;
    			a = temp;
    		}

    		a *= 2;
    		long side = Math.max(a, b);
    		System.out.println(side * side);
    	}

    }

    static class FastScanner{

    	BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    	StringTokenizer st = new StringTokenizer("");
    	String next() {
    		while(!st.hasMoreTokens())
    			try {
    				st = new StringTokenizer(br.readLine());
    			} catch (IOException e){
    				e.printStackTrace();
    			}
    		return st.nextToken();
    	}

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

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

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

    }

}


import java.util.Scanner;

public class Solution {
    public static void main(String[] args){
        Scanner sc= new Scanner(System.in);
        int t= sc.nextInt();
        while (t-->0){
            int a= sc.nextInt();
            int b= sc.nextInt();
            int min=Math.min(a,b);
            int max=Math.max(a,b);
            if(max>=2*min){
                System.out.println(max*max);
                continue;
            }
            int x=2*min;
            int y=Math.max(x,max);
            System.out.println(x*y);
        }
    }
}


public class Solution{
    public static int minimalSquare(int a, int b){
        if(a>b){
            return 2*b;
        }else{
            return 2*a;
        }
    }
}


public class M{
    public int minimalSquare(int a, int b){
    if(a>b){
        return 2*b;
    }else{
        return 2*a;
    }
}


public class Mminimal{
    public int minimalSquare(int a, int b){
        if(a>b){
            return 2*b;
        }else{
            return 2*a;
        }
    }
}


import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.*;
import java.io.*;

public class Main{
	public static void main (String[] args) throws IOException {
		Scanner sc = new Scanner(System.in);
		PrintWriter pw = new PrintWriter(System.out);
		int n = sc.nextInt();
		while(n-->0) {
			int a = sc.nextInt(); int b = sc.nextInt();
			for(int i = 1 ; i <=200 ; i ++) {
				if(b> i || a>i)
					continue;
				if(i*i >= 2*a*b && (i>=2*a || i>=2*b)) {
					pw.println(i*i);
					break;
				}
			}
		}
			pw.close();
		}

	}

	 class Scanner {
		StringTokenizer st;
		BufferedReader br;

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

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

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

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

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

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

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

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


import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.*;
import java.io.*;

public class Main{
	public static void main (String[] args) throws IOException {
		Scanner sc = new Scanner(System.in);
		PrintWriter pw = new PrintWriter(System.out);
		int n = sc.nextInt();
		while(n-->0) {
			int a = sc.nextInt(); int b = sc.nextInt();
			for(int i = 1 ; i <=200 ; i ++) {
				if(i*i >= 2*a*b && (i>=2*a || i>=2*b)) {
					pw.println(i*i);
					break;
				}
			}
		}
			pw.close();
		}

	}

	 class Scanner {
		StringTokenizer st;
		BufferedReader br;

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

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

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

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

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

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

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

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


//package sorev1;

import java.util.Scanner;

public class A {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        for (int i = 0; i < n; i++) {

            int a = sc.nextInt();
            int b = sc.nextInt();
            if(a == b){
                System.out.println(4* a * a);

            }else if(Math.min(a,b) == 1 && Math.max(a,b) > 1){
                System.out.println(Math.max(a,b) * Math.max(a,b));
            }
            else{
                int m = Math.max(a,b);
                int t = m - Math.abs(a-b);
                int res = (int)Math.pow(2*t,2);
                System.out.println(res);
            }
        }
    }
}


//package sorev1;

import java.util.*;

public class B {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int t = sc.nextInt();
        for (int k = 0; k < t; k++) {
            int n = sc.nextInt();
            int[] b = new int[n];
            for (int i = 0; i < n; i++) {
                b[i] = sc.nextInt();
            }
            if(dis(b) == true){
                System.out.println(0);
            }else {
                Arrays.sort(b);
                int res = Integer.MAX_VALUE;
                for (int i = 1; i < n; i++) {
                    if(res > b[i] - b[i - 1])
                        res = b[i] - b[i - 1];
                }
                System.out.println(res);
            }
        }
    }
    public static boolean dis(int[] b){
        boolean bool = false;
        for (int i = 0; i < b.length; i++) {
            for (int j = i + 1; j < b.length; j++) {
                if(b[i] == (b[j])) {
                    bool = true;
                }
            }
        }
        return bool;
    }
}


//package sorev1;

import java.util.Scanner;

public class A {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        for (int i = 0; i < n; i++) {

            int a = sc.nextInt();
            int b = sc.nextInt();
            int max = Math.max(a,b);
            int min = Math.min(a,b);
            if(a ==b){
                System.out.println((int)Math.pow(2*a,2));

            }else if(2 * min <= max){
                System.out.println((int) Math.pow(max,2));
            }else if (min * 2 >= max){
                System.out.println((int) Math.pow(2*min,2));
            }
    }
    }
}


import java.lang.Math;
import java.util.*;
public class Square
{
	public static void main(String []args)
	{
		Scanner sc=new Scanner(System.in);
		int t=sc.nextInt();
		while(t-->0)
		{
			int a=sc.nextInt();
			int b=sc.nextInt();
			if (a!=b)
			{
				int temp=Math.max(a,b)*Math.max(a,b);
				if( Math.sqrt(temp)!=Math.max(a,b))
				{
					temp=(int) Math.ceil(Math.sqrt(temp))+temp;
				}
				System.out.println(temp);
			}
			else
				System.out.println(a*a*4);
		}
	}
}


import java.lang.Math;
import java.util.*;
public class Square
{
	public static void main(String []args)
	{
		Scanner sc=new Scanner(System.in);
		int t=sc.nextInt();
		while(t-->0)
		{
			int a=sc.nextInt();
			int b=sc.nextInt();
			if (a!=b)
			{
				int temp=a*b*2;
				if( Math.sqrt(temp)!=Math.max(a,b))
				{
					temp=(int) Math.ceil(Math.sqrt(temp))+temp;
				}
				System.out.println(temp);
			}
			else
				System.out.println(a*a*4);
		}
	}
}


import java.lang.Math;
import java.util.*;
public class Square
{
	public static void main(String []args)
	{
		Scanner sc=new Scanner(System.in);
		int t=sc.nextInt();
		while(t-->0)
		{
			int a=sc.nextInt();
			int b=sc.nextInt();
			int ans=(int) Math.pow(Math.min(Math.max(2*a,b),Math.max(a,2*b)),2);
			System.out.println(ans);
		}
	}
}


import java.lang.Math;
import java.util.*;
public class Square
{
	public static void main(String []args)
	{
		Scanner sc=new Scanner(System.in);
		int t=sc.nextInt();
		while(t-->0)
		{
			int a=sc.nextInt();
			int b=sc.nextInt();
			if (a!=b)
			{
				int rect=a*b*2;
				int m=Math.max(a,b);
				if (rect<=m*m)
					System.out.println(m*m);
				else
					System.out.println((m+1)*(m+1));
			}
			else
				System.out.println(a*a*4);
		}
	}
}


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

/* Name of the class has to be "Main" only if the class is public. */
public class Solution
{

    static Scanner sc = new Scanner(System.in);
	static PrintWriter out = new PrintWriter(System.out);
	public static void main(String[]args)throws IOException{
		try{

			new Solution().run();

		}catch(Exception e){
			return;
		}

	}
	static void run(){

		// FIRST CASE -- RETURN TYPE SOLVE
		int t = sc.nextInt();
		StringBuilder ans = new StringBuilder("");
		while(t-- > 0 ){
			ans.append(solve()).append("\n");

		}
		out.println(ans);

		// FOR SECOND CASE --  void solve()
		//while(t-- > 0 ){
		//solve();
		//}
	}
	static int solve(){
		int a = sc.nextInt();
        int b = sc.nextInt();
        int are = 2*a*b;
        int max = Math.max(a,b);
        int ans = max*max;
        if( a == b ){
            ans = 4*a*b;
        }else {
            while (ans < are) {
                max++;
                ans = max * max;
            }
        }
		return ans;

	}

}


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

/* Name of the class has to be "Main" only if the class is public. */
public class Solution
{
    static class Reader{
        final private int BUFFER_SIZE = 1 << 20;
        private DataInputStream din;
        private byte[] buffer;
        private int bufferPointer, bytesRead;

        public Reader()
        {
            din = new DataInputStream(System.in);
            buffer = new byte[BUFFER_SIZE];
            bufferPointer = bytesRead = 0;
        }

        public Reader(String file_name) throws IOException
        {
            din = new DataInputStream(new FileInputStream(file_name));
            buffer = new byte[BUFFER_SIZE];
            bufferPointer = bytesRead = 0;
        }

        public String readLine() throws IOException
        {
            byte[] buf = new byte[1000000]; // line length
            int cnt = 0, c;
            while ((c = read()) != -1)
            {
                if (c == '\n')
                    break;
                buf[cnt++] = (byte) c;
            }
            return new String(buf, 0, cnt);
        }

        public int nextInt() throws IOException
        {
            int ret = 0;
            byte c = read();
            while (c <= ' ')
                c = read();
            boolean neg = (c == '-');
            if (neg)
                c = read();
            do
            {
                ret = ret * 10 + c - '0';
            }  while ((c = read()) >= '0' && c <= '9');

            if (neg)
                return -ret;
            return ret;
        }

        public long nextLong() throws IOException
        {
            long ret = 0;
            byte c = read();
            while (c <= ' ')
                c = read();
            boolean neg = (c == '-');
            if (neg)
                c = read();
            do {
                ret = ret * 10 + c - '0';
            }
            while ((c = read()) >= '0' && c <= '9');
            if (neg)
                return -ret;
            return ret;
        }

        public double nextDouble() throws IOException
        {
            double ret = 0, div = 1;
            byte c = read();
            while (c <= ' ')
                c = read();
            boolean neg = (c == '-');
            if (neg)
                c = read();

            do {
                ret = ret * 10 + c - '0';
            }
            while ((c = read()) >= '0' && c <= '9');

            if (c == '.')
            {
                while ((c = read()) >= '0' && c <= '9')
                {
                    ret += (c - '0') / (div *= 10);
                }
            }

            if (neg)
                return -ret;
            return ret;
        }

        private void fillBuffer() throws IOException
        {
            bytesRead = din.read(buffer, bufferPointer = 0, BUFFER_SIZE);
            if (bytesRead == -1)
                buffer[0] = -1;
        }

        private byte read() throws IOException
        {
            if (bufferPointer == bytesRead)
                fillBuffer();
            return buffer[bufferPointer++];
        }

        public void close() throws IOException
        {
            if (din == null)
                return;
            din.close();
        }

    }
    static Reader sc = new Reader();
	static PrintWriter out = new PrintWriter(System.out);
	public static void main(String[]args)throws IOException{
		try{

			new Solution().run();

		}catch(Exception e){
			return;
		}

	}
	static void run(){

		// FIRST CASE -- RETURN TYPE SOLVE
		int t = sc.nextInt();
		StringBuilder ans = new StringBuilder("");
		while(t-- > 0 ){
			ans.append(solve()).append("\n");

		}
		out.println(ans);

		// FOR SECOND CASE --  void solve()
		//while(t-- > 0 ){
		//solve();
		//}
	}
	static int solve(){
		int a = sc.nextInt();
        int b = sc.nextInt();
        int are = 2*a*b;
        int max = Math.max(a,b);
        int ans = max*max;
        if( a == b ){
            ans = 4*a*b;
        }else {
            while (ans < are) {
                max++;
                ans = max * max;
            }
        }
		return ans;

	}

}


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

/* Name of the class has to be "Main" only if the class is public. */
public class Solution
{

    static Scanner sc = new Scanner(System.in);
	static PrintWriter out = new PrintWriter(System.out);
	public static void main(String[]args)throws IOException{
		try{

			new Solution().run();

		}catch(Exception e){
			return;
		}

	}
	static void run(){

		// FIRST CASE -- RETURN TYPE SOLVE
		int t = sc.nextInt();
		StringBuilder ans = new StringBuilder("");
		while(t-- > 0 ){
			ans.append(solve()).append("\n");

		}
		out.println(ans);

		// FOR SECOND CASE --  void solve()
		//while(t-- > 0 ){
		//solve();
		//}
	}
	static int solve(){
		int a = sc.nextInt();
        int b = sc.nextInt();
        int are = 2*a*b;
        int min = Math.min(a,b);
        int max = Math.max(a,b);
        int ans = 0;
        if(2*min >=  max ){
            ans = (int)Math.pow((2*min),2);
        }else{
            ans = (int)Math.pow(max,2);
        }
		return ans;

	}

}


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

/* Name of the class has to be "Main" only if the class is public. */
public class Solution
{
    static class Reader{
        final private int BUFFER_SIZE = 1 << 20;
        private DataInputStream din;
        private byte[] buffer;
        private int bufferPointer, bytesRead;

        public Reader()
        {
            din = new DataInputStream(System.in);
            buffer = new byte[BUFFER_SIZE];
            bufferPointer = bytesRead = 0;
        }

        public Reader(String file_name) throws IOException
        {
            din = new DataInputStream(new FileInputStream(file_name));
            buffer = new byte[BUFFER_SIZE];
            bufferPointer = bytesRead = 0;
        }

        public String readLine() throws IOException
        {
            byte[] buf = new byte[1000000]; // line length
            int cnt = 0, c;
            while ((c = read()) != -1)
            {
                if (c == '\n')
                    break;
                buf[cnt++] = (byte) c;
            }
            return new String(buf, 0, cnt);
        }

        public int nextInt() throws IOException
        {
            int ret = 0;
            byte c = read();
            while (c <= ' ')
                c = read();
            boolean neg = (c == '-');
            if (neg)
                c = read();
            do
            {
                ret = ret * 10 + c - '0';
            }  while ((c = read()) >= '0' && c <= '9');

            if (neg)
                return -ret;
            return ret;
        }

        public long nextLong() throws IOException
        {
            long ret = 0;
            byte c = read();
            while (c <= ' ')
                c = read();
            boolean neg = (c == '-');
            if (neg)
                c = read();
            do {
                ret = ret * 10 + c - '0';
            }
            while ((c = read()) >= '0' && c <= '9');
            if (neg)
                return -ret;
            return ret;
        }

        public double nextDouble() throws IOException
        {
            double ret = 0, div = 1;
            byte c = read();
            while (c <= ' ')
                c = read();
            boolean neg = (c == '-');
            if (neg)
                c = read();

            do {
                ret = ret * 10 + c - '0';
            }
            while ((c = read()) >= '0' && c <= '9');

            if (c == '.')
            {
                while ((c = read()) >= '0' && c <= '9')
                {
                    ret += (c - '0') / (div *= 10);
                }
            }

            if (neg)
                return -ret;
            return ret;
        }

        private void fillBuffer() throws IOException
        {
            bytesRead = din.read(buffer, bufferPointer = 0, BUFFER_SIZE);
            if (bytesRead == -1)
                buffer[0] = -1;
        }

        private byte read() throws IOException
        {
            if (bufferPointer == bytesRead)
                fillBuffer();
            return buffer[bufferPointer++];
        }

        public void close() throws IOException
        {
            if (din == null)
                return;
            din.close();
        }
		public []int nextarray(int n){

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

		}
		public []int nextarray(int n,int i){
			int[]ar = new int[n+i];
			for(int j=i;j<n+i;j++){
				ar[j] = nextInt();
			}
			return ar;

		}
		public[]long nextlongarray(int n){
			long[]ar = new long[n];
			for(int i=0;i<n;i++){
				ar[i] = nextLong();
			}
			return ar;
		}
		public[]long nextlongarray(int n, int i){
			long[]ar = new long[n+i];
			for(int j=i;j<i+n;j++){
				ar[j] = nextLong();
			}
			return ar;
		}
    }
    static Reader sc = new Reader();
	static PrintWriter out = new PrintWriter(System.out);
	public static void main(String[]args)throws IOException{
		try{

			new Solution().run();

		}catch(Exception e){
			return;
		}

	}
	static void run(){

		// FIRST CASE -- RETURN TYPE SOLVE
		int t = sc.nextInt();
		StringBuilder ans = new StringBuilder("");
		while(t-- > 0 ){
			ans.append(solve()).append("\n");

		}
		out.println(ans);

		// FOR SECOND CASE --  void solve()
		//while(t-- > 0 ){
		//solve();
		//}
	}
	static int solve(){
		int a = sc.nextInt();
        int b = sc.nextInt();
        int are = 2*a*b;
        int max = Math.max(a,b);
        int ans = max*max;
        if( a == b ){
            ans = 4*a*b;
        }else {
            while (ans < are) {
                max++;
                ans = max * max;
            }
        }
		return ans;

	}

}