#include<bits/stdc++.h>
using namespace std;
int f[1001],head[1001];
struct node{
int x,t;
};
int in,ui;
char ch;
int read()
{
in=0;
ch=getchar();
ui=1;
while(ch<'0'||ch>'9')
{
if(ch=='-')ui=-1;
ch=getchar();
}
while(ch>='0'&&ch<='9')
{
in=in*10+ch-'0';
ch=getchar();
}
return in*ui;
}
struct node2{
int x,next;
}d[50001];
struct que{
node a[2000001];
int h,t;
void del()
{
while(t>=h&&f[a[h].x])h++;
while(t>=h&&f[a[t].x])t--;
}
bool empty(){del();return t<h;}
void push(node x){a[++t]=x;}
void pop(){h++;}
node front(){del();return a[h];}
void clear(){t=0,h=1;}
int size(){del();return t-h+1;}
}q;
int ans;
void bfs(node x)
{
q.push(x);
while(!q.empty())
{
x=q.front();
q.pop();
ans=max(ans,x.t);
f[x.x]=1;
for(int i=head[x.x];i;i=d[i].next)
{
q.push(node{d[i].x,x.t+1});
}
}
}
int main()
{
int n,m,x,y,k=0;
for(;;)
{
n=read();
m=read();
if(n==0&&m==0)return 0;
k=ans=0;
memset(head,0,sizeof(head));
for(int i=1;i<=m;i++)
{
x=read();
y=read();
k++;
d[k]=node2{y,head[x]};
head[x]=k;
k++;
d[k]=node2{x,head[y]};
head[y]=k;
}
for(int i=1;i<=n;i++)
{
memset(f,0,sizeof(f));
bfs(node{i,0});
}
printf("%d\n",ans*100);
}
return 0;
}