/*Saddle Point is the element which has the minimum value in a row and maximum value in a column.
*Only one saddle point can be there in a dda.
*In dda, 11 18 19
* 10 20 23
* 13 16 19
* Saddle point in this dda is 13.
*/
import java.util.*;
class saddlepoint
{
public static void main()
{
Scanner s=new Scanner(System.in);
System.out.println("Enter the size of the DDA");
int size=s.nextInt();
int arr[][]=new int[size][size];
int i,j,flag=0,min,max,col,row;
System.out.println("Enter the elements of the DDA");
for (i=0;i< size;i++)
{
for (j=0;j< size;j++)
{
arr[i][j]=s.nextInt();
}
}
for (i=0;i< size;i++)
{
min=arr[i][0];
col=0;
for (j=0;j< size;j++)
{
if (arr[i][j]< min)
{
min=arr[i][j];
col=j;
}
}
max=arr[0][col];
for (int m=0;m< size;m++)
{
if (arr[m][col]>max)
{
max=arr[m][col];
}
}
if(min==max)
{
System.out.println("Saddle point found is "+min);
flag=1;
break;
}
}
if (flag==0)
System.out.println("Saddle point not found");
}
}