{$APPTYPE CONSOLE}

uses
  Math;
var
  f: TextFile;
  i, j, k, N, side, maxSide, maxi, maxj: Integer;
  A: array of array of Integer;
  ok: Boolean;
begin
 // AssignFile(f, 'input.txt'); Reset(f);
  Read(N);
  SetLength(A, N + 1, N + 1);
  for i := 1 to N do
    for j := 1 to N do
      Read(A[i, j]);
//  CloseFile(f);
  maxSide := -1; maxi := 0; maxj := 0;
  for i := 1 to N do
    for j := 1 to N do
      for side := 0 to N - Max(i, j) do begin
        ok := true;
        for k := 0 to side do begin
          if
            (A[i + k, j] <> A[i + k, j + side]) or
            (A[i, j + k] <> A[i + side, j + k])
          then begin
            ok := false;
            break;
          end;
        end;
        if ok and (side > maxSide) then begin
          maxSide := side;
          maxi := i; maxj := j;
        end;
      end;
//  AssignFile(f, 'output.txt'); Rewrite(f);
  Write(maxi, ' ', maxj, ' ', maxSide + 1);
//  CloseFile(f);
end.
