program Untitled;
var
   n, i, j, k, z, S : integer;
   a, b, c, d, max : array [ 1..100000 ] of integer;
begin
     readln ( n );
     for i := 1 to n do
     begin
          readln ( a[i], b[i] );
          c[i] := a[i];
          d[i] := b[i];
          for j := 1 to i do
          begin
               for k := j to i do
               begin
                    if c[j] > c[k] then
                    begin
                         z := c[j];
                         c[j] := c[k];
                         c[k] := z;
                    end;
                    if d[j] > d[k] then
                    begin
                         z := d[j];
                         d[j] := d[k];
                         d[k] := z;
                    end;
               end;
          end;
          for j := 1 to i do
          begin
               s := c[j] + d[i - j + 1];
               if s > max[i] then max[i] := s;
          end;
     end;
     for i := 1 to n do
         writeln ( max[i] );
readln;
end.
