program chocolate;

{$APPTYPE CONSOLE}

uses
  SysUtils;
var p:array[1..10000] of longint;
    i,j,k,l,m,n:longint;
function prost(t:longint):boolean;
var y:longint;
begin
   if (t=2)or(t=3) then
   begin
      prost:=true;
      exit;
   end;

   for y:=2 to round(sqrt(t)) do
   if t mod y = 0 then
   begin
      prost:=false;
      exit;
   end;

   prost:=true;

end;

begin
   reset(input,'chocolate.in');
   fillchar(p,sizeof(p),0);
   l:=0;
   for i:=2 to 10000 do
   begin
      if odd(i) then if prost(i) then
      begin
         l:=l+1;
         p[l]:=i;
      end;
   end;
   read(n);
   for i:=1 to n do
   begin
      read(k);
      if odd(k) then writeln(0) else writeln( p[(k*k) div 4]);
   end;



end.
