public void solve() throws IOException {
    int n = nextInt();
    int m = nextInt();
    int i = nextInt();
    int j = nextInt();
    int a = nextInt();
    int b = nextInt();

    int[] min = new int[4];
    for (int x = 0; x < 4; x++)
      min[x] = 1000000;

    int[][] co = { { 1, m }, { n, 1 }, { n, m }, { 1, 1 } };
    for (int x = 0; x < co.length; x++) {
      int xdiff = co[x][0] - i;
      int ydiff = co[x][1] - j;
      if (xdiff % a == 0 && ydiff % b == 0) {
        int xmov = Math.abs(xdiff / a);
        int ymov = Math.abs(ydiff / b);
        // System.out.println(xmov + " " + ymov);
        if (Math.abs(xmov - ymov) % 2 == 0)
          min[x] = Math.max(xmov, ymov);
      }
      // System.out.println(min[x]);
    }

    int moves = 1000000;
    for (int x = 0; x < 4; x++)
      moves = Math.min(moves, min[x]);
    if (moves == 1000000)
      System.out.println("Poor Inna and pony!");
    else
      System.out.println(moves);

  }