program weighing;

{$APPTYPE CONSOLE}

uses
  SysUtils;

var n,m,i,t,j,buf,s,a:integer;
function money(n:real):integer;
begin
  if (n<=3) and (n>=1) then
  s:=s+1
  else
  begin
  s:=s+1;
  money(n/3);

  end;
 money:=s;
end;
begin

assignfile(input,'WEIGHING.IN');
reset(input);
readln(t);
for i := 1 to t do begin
 s:=0;
readln(n);
writeln(money(n));

end;
  close(input);
end.
