#include<cstdio> #include<cstring> #include<iostream> #include<algorithm> #define MAXN 2010 using namespace std; int fa[MAXN]; int n,ans,tot; char s[MAXN][8]; struct nond{ int x,y,z; }v[MAXN*MAXN]; int cmp(nond a,nond b){ return a.x<b.x; } int find(int x){ if(fa[x]==x) return x; else return fa[x]=find(fa[x]); } int main(){ while(scanf("%d",&n)&&n){ for(int i=1;i<=n;i++) cin>>s[i]; for(int i=1;i<=n;i++) for(int j=i+1;j<=n;j++){ int sum=0; for(int k=0;k<7;k++) if(s[i][k]!=s[j][k]) sum++; v[++tot].x=i;v[tot].y=j;v[tot].z=sum; } sort(v+1,v+1+tot,cmp); for(int i=1;i<=n;i++) fa[i]=i; for(int i=1;i<=tot;i++){ int dx=find(v[i].x); int dy=find(v[i].y); if(dx==dy) continue; fa[dy]=dx; ans+=v[i].z; } printf("The highest possible quality is 1/%d.\n",ans); ans=0;tot=0; } }