#include <iostream>

using namespace std;

int main(void){

  while(1){
    int n;
    cin >> n;
    if(n == 0){return 0;}

    int m[n + 1];
    int x[n + 1][10];
    int y[n + 1][10];

    for(int i = 0 ; i <= n ; i++){
      cin >> m[i];
      for(int j = 0 ; j < m[i] ; j++){
        cin >> x[i][j];
        cin >> y[i][j];
      }
    }

    //??£??????

    for(int i = 0 ; i <= n ; i++){
      int x0 = x[i][0];
      int y0 = y[i][0];
      for(int j = 0 ; j < m[i] ; j++){
        x[i][j] = x[i][j] - x0;
        y[i][j] = y[i][j] - y0;
      }
    }


    //x[0][i]??¨y[0][i]????????¢?????????????????¨???????????????
    int tmpx[8][10];
    int tmpy[8][10];
    //????????????
    for(int i = 0 ; i < m[0] ; i++){
      tmpx[0][i] = x[0][i];
      tmpy[0][i] = y[0][i];
    }
    //90???????????¢
    for(int i = 0 ; i < m[0] ; i++){
      tmpx[1][i] = y[0][i];
      tmpy[1][i] = -x[0][i];
    }
    //180???????????¢
    for(int i = 0 ; i < m[0] ; i++){
      tmpx[2][i] = -x[0][i];
      tmpy[2][i] = -y[0][i];
    }
    //270???????????¢
    for(int i = 0 ; i < m[0] ; i++){
      tmpx[3][i] = -y[0][i];
      tmpy[3][i] = x[0][i];
    }

    int tmprx[m[0]];
    int tmpry[m[0]];

    for(int j = 0 ; j < m[0] ; j++){
      tmprx[j] = x[0][m[0]-j-1] - x[0][m[0]-1];
      tmpry[j] = y[0][m[0]-j-1] - y[0][m[0]-1];
    }

    //???
    for(int i = 0 ; i < m[0] ; i++){
      tmpx[4][i] = tmprx[i];
      tmpy[4][i] = tmpry[i];
    }
    //???1
    for(int i = 0 ; i < m[0] ; i++){
      tmpx[5][i] = tmpry[i];
      tmpy[5][i] = -tmprx[i];
    }
    //???2
    for(int i = 0 ; i < m[0] ; i++){
      tmpx[6][i] = -tmprx[i];
      tmpy[6][i] = -tmpry[i];
    }
    //???3
    for(int i = 0 ; i < m[0] ; i++){
      tmpx[7][i] = -tmpry[i];
      tmpy[7][i] = tmprx[i];
    }

    //?????´????????????
    for(int i = 1 ; i <= n ; i++){
      bool flg0 = true;
      bool flg1 = true;
      bool flg2 = true;
      bool flg3 = true;
      bool flg4 = true;
      bool flg5 = true;
      bool flg6 = true;
      bool flg7 = true;
      if(m[0] != m[i]){
        flg0 = false;
        flg1 = false;
        flg2 = false;
        flg3 = false;
        flg4 = false;
        flg5 = false;
        flg6 = false;
        flg7 = false;
      }else{
//        cout << "??\??£???" << endl;
        for(int j = 0 ; j < m[i] && flg0 ; j++){
          if(x[i][j] != tmpx[0][j] || y[i][j] != tmpy[0][j]){
            flg0 = false;
//            cout << "tmpx[0][" << j << "] = " << tmpx[0][j] << endl;
//            cout << "tmpy[0][" << j << "] = " << tmpy[0][j] << endl;
//            cout << "   x[" << i << "][" << j << "] = " << x[i][j] << endl;
//            cout << "   x[" << i << "][" << j << "] = " << y[i][j] << endl;
          }
        }

        for(int j = 0 ; j < m[i] && flg1 ; j++){
          if(x[i][j] != tmpx[1][j] || y[i][j] != tmpy[1][j]){
            flg1 = false;
//            cout << "tmpx[1][" << j << "] = " << tmpx[1][j] << endl;
//            cout << "tmpy[1][" << j << "] = " << tmpy[1][j] << endl;
//            cout << "   x[" << i << "][" << j << "] = " << x[i][j] << endl;
//            cout << "   x[" << i << "][" << j << "] = " << y[i][j] << endl;
          }
        }

        for(int j = 0 ; j < m[i] && flg2 ; j++){
          if(x[i][j] != tmpx[2][j] || y[i][j] != tmpy[2][j]){
            flg2 = false;
//            cout << "tmpx[2][" << j << "] = " << tmpx[2][j] << endl;
//            cout << "tmpy[2][" << j << "] = " << tmpy[2][j] << endl;
//            cout << "   x[" << i << "][" << j << "] = " << x[i][j] << endl;
//            cout << "   x[" << i << "][" << j << "] = " << y[i][j] << endl;
          }
        }

        for(int j = 0 ; j < m[i] && flg3 ; j++){
          if(x[i][j] != tmpx[3][j] || y[i][j] != tmpy[3][j]){
            flg3 = false;
//            cout << "tmpx[3][" << j << "] = " << tmpx[3][j] << endl;
//            cout << "tmpy[3][" << j << "] = " << tmpy[3][j] << endl;
//            cout << "   x[" << i << "][" << j << "] = " << x[i][j] << endl;
//            cout << "   x[" << i << "][" << j << "] = " << y[i][j] << endl;
          }
        }

        for(int j = 0 ; j < m[i] && flg4 ; j++){
          if(x[i][j] != tmpx[4][j] || y[i][j] != tmpy[4][j]){
            flg4 = false;
//            cout << "tmpx[4][" << j << "] = " << tmpx[4][j] << endl;
//            cout << "tmpy[4][" << j << "] = " << tmpy[4][j] << endl;
//            cout << "   x[" << i << "][" << j << "] = " << x[i][j] << endl;
//            cout << "   y[" << i << "][" << j << "] = " << y[i][j] << endl;
          }
        }

        for(int j = 0 ; j < m[i] && flg5 ; j++){
          if(x[i][j] != tmpx[5][j] || y[i][j] != tmpy[5][j]){
            flg5 = false;
//            cout << "tmpx[5][" << j << "] = " << tmpx[5][j] << endl;
//            cout << "tmpy[5][" << j << "] = " << tmpy[5][j] << endl;
//            cout << "   x[" << i << "][" << j << "] = " << x[i][j] << endl;
//            cout << "   y[" << i << "][" << j << "] = " << y[i][j] << endl;
          }
        }

        for(int j = 0 ; j < m[i] && flg6 ; j++){
          if(x[i][j] != tmpx[6][j] || y[i][j] != tmpy[6][j]){
            flg6 = false;
//            cout << "tmpx[6][" << j << "] = " << tmpx[6][j] << endl;
//            cout << "tmpy[6][" << j << "] = " << tmpy[6][j] << endl;
//            cout << "   x[" << i << "][" << j << "] = " << x[i][j] << endl;
//            cout << "   y[" << i << "][" << j << "] = " << y[i][j] << endl;
          }
        }

        for(int j = 0 ; j < m[i] && flg7 ; j++){
          if(x[i][j] != tmpx[7][j] || y[i][j] != tmpy[7][j]){
            flg7 = false;
//            cout << "tmpx[7][" << j << "] = " << tmpx[7][j] << endl;
//            cout << "tmpy[7][" << j << "] = " << tmpy[7][j] << endl;
//            cout << "   x[" << i << "][" << j << "] = " << x[i][j] << endl;
//            cout << "   y[" << i << "][" << j << "] = " << y[i][j] << endl;
          }
        }

      }

      if(flg0 || flg1 || flg2 || flg3 || flg4 || flg5 || flg6 || flg7){cout << i << endl;}
    }
    cout << "+++++" << endl;

  }
}

Measured memory_bytes: 3052