program stairs;

{$APPTYPE CONSOLE}

uses
  SysUtils, System;
var
  f: TextFile;
  l: string;
  tests,test,c,s,i: integer;

begin
  { TODO -oUser -cConsole Main : Insert code here }
  AssignFile(f,'stairs.in');
  Reset(f);
  ReadLn(f,l);
  tests:=StrToInt(l);
  for test:=1 to tests do begin
    ReadLn(f,l);
    c:=StrToInt(l);
    s:=1;
    while s<=c do begin
      c:=c-s;
      inc(s);
    end;
    writeLn(IntToStr(s-1));
  end;
  CloseFile(f);
end.
