#0005E1

O-klizaliste

You are given matrix of letters. Matrix is NxN. Letters can lowercase and uppercase.


Your task is to found maximal square area but only among squares with diagonally opposite vertex parallel with sides of matrix and contain only uppercase letters.


InputIn first line of input is integer N dimension of matrix (N <= 500).
In next N lines there are N uppercase or lowercase English letters.

OutputIn first line of input write maximal number of letters in squares defined above.

Input:

9
KOBASICEM
LVANJATSA
ISTEFAELR
PKUKICAAT
ATEACAmVI
MILICAMNN
AKDRAGIIX
KNATASSAC
ITAMARAET

Output:
25


EXPLANATION: The only lowercase letter in matrix results that maximal area of desired squares is 25 instead of 41 (Top vertex for result square are: row 1 column 4 or row 3 column 4 ).


Input:

11
mandaKlenjo
igorLIPlele
jojAIKOMsom
nePANIJASUe
eSUPERISKAo
buALEDJEKua
lULISTRAjao
samoVAJlezu
kakviEpapAn
ineopisiVOI
BojanstraVa

Output:
41


EXPLANATION: Top vertex for result square is in row 1 column 6.


Submit solution

Coming later

The grading service will be connected in a later migration step. You can inspect the task and your previous results now.