#include #include using namespace std; double a[200][200]; int C; bool testa(int start,int act,double val) { //cout << "test "<0.0000000001) { //cout<<"kurs"<999.9999999 && val*a[act][i]<1000.000001)return false; if(i==start && val*a[act][i]>1000.0) return true; if(testa(start,i,val*a[act][i]))return true; } return false; } int main(int argc, char** argv){ //int C = 0; scanf("%d",&C); char cur[200][3]; while(C) { for(int i = 0;i<200;i++) for(int j = 0;j<200;j++) a[i][j]=0.0; char c[3]; for(int i = 0;i> c; for(int w = 0;w<3;w++)cur[i][w] = c[w]; } int R = 0; cin >> R; if(R == 0){cout << "Ok" << endl; cin>>C; continue;} for(int i = 0;i> c1; cin >> c2; cin >> k1; cin >> cx; cin >> k2; exr = (double)k2 / (double)k1; while(cur[j][0]!=c1[0] && cur[j][1]!=c1[1] && cur[j][2]!=c1[2])j++; while(cur[h][0]!=c2[0] && cur[h][1]!=c2[1] && cur[h][2]!=c2[2])h++; a[j][h]=exr; //cout << "a["<> C; } return 0; }