1. C, Tobias Fuchs

/*
* Author: Tobias Fuchs
* Problem: 423
* Verdict: Accepted
* Runtime: 0.000
*/

#include<stdio.h>
#include<stdlib.h>
#include<string.h>

#define MIN(a,b) (a > b? b:a)
#define INFTY 0xffff

int A[100][100];
int N;

void floyd()
{
int i, j, k;
for(k = 1; k <= N; k ++) {
for(i = 1; i<=N; i++) {
for(j = 1; j<= N; j++) {
A[i][j] = MIN(A[i][j],A[i][k]+A[k][j]);
}
}
}
}

unsigned int calculate_floyd()
{
int i, max = 0;
floyd();
for(i =1; i<= N; i++ )
{
if(A[1][i] > max) {
max = A[1][i];
}
}
return max;
}

int main()
{
int i, j, max, c;
char buffer[100];

while(scanf("%d",&N) == 1)
{
for(c = 1; c<=N; c++) A[c][c] = 0;
for(i = 2; i<=N; i++)
{
for(j = 1; j<i; j++) {
scanf("%s",buffer);
if(!strcmp(buffer,"x")) {
A[j][i] = INFTY;
A[i][j] = INFTY;
}
else {
A[i][j] = atoi(buffer);
A[j][i] = atoi(buffer);
}
}
}
if(N == 1) {
printf("0\n");
}
else {
max = calculate_floyd();
printf("%d\n",max);
}
}
return 0;
}