#include<iostream>
#include<cmath>
#include<algorithm>
#include<vector>
#include<cassert>
#define REP(i,s,n) for(int i=s;i<n;i++)
#define rep(i,n) REP(i,0,n)
#define inf (1<<29)
#define MAX 500
using namespace std;

/*
手が壁から離れた -> 手の方向に向きを変える
目の前が壁　　　 -> 手の方向と逆に向きを変える
 */

int W,H,N,xS,yS,xG,yG;
char G[MAX][MAX];
int dx2[2][2] = {{-1,+1},{0,0}};
int dy2[2][2] = {{0,0},{+1,-1}};
/*
int dx[] = {-1,0,1,0};
int dy[] = {0,-1,0,1};
*/
int dx[] = {0,1,0,-1};
int dy[] = {-1,0,1,0};

void print()
{
  cout << "print---" << endl;
  rep(i,2*H+3)
    {
      rep(j,2*W+3)
	{
	  cout << G[i][j];
	}
      cout << endl;
    }
  cout << endl;
}


void initGraph()
{
  rep(i,MAX)rep(j,MAX)G[i][j] = 'x';
  rep(i,2*H+1)
    {
      for(int j=(i%2?0:1);j<2*W+1;j+=2)
	{
	  char c = (i%2?'|':'-');
	  if(i == 0 || j == 0 || i == 2*H || j == 2*W)
	  G[i][j] = c;
	  rep(k,2)
	    {
	      int nx = j + dx2[i%2][k];
	      int ny = i + dy2[i%2][k];
	      if(!(0 <= nx && nx < 2*W+1 && 0 <= ny && ny < 2*H+1))continue;
	      if(nx == 0 || ny == 0 || nx == 2*W || ny == 2*H)
		G[ny][nx] = 'o';
	    }
	}
    }

}


void drawO(int x,int y)
{
  //cout << "draw " << x << "," << y << endl;
  rep(k,2)
    {
      int nx = x + dx2[y%2][k];
      int ny = y + dy2[y%2][k];
      if(!(0 <= nx && nx < 2*W+1 && 0 <= ny && ny < 2*H+1))continue;
	G[ny][nx] = 'o';
    }
}

void makeGraph()
{
  int x1,y1,x2,y2;
  rep(i,N)
    {
      cin >> x1 >> y1 >> x2 >> y2;
      //cout << "from " << x1 << "," << y1 << " " << x2 << "," << y2 << endl;
      if(x1 == x2)
	{
	  if(y1 > y2)swap(y1,y2);
	  x1 *= 2, y1 = y1*2+1, y2 = y2*2+1;
      //cout << x1 << "," << y1 << " " << x2 << "," << y2 << endl;
	  for(int y=y1;y<y2;y+=2)
	    {
	      G[y][x1] = '|';
	      drawO(x1,y);
	    }
	}
      else if(y1 == y2)
	{
	  if(x1 > x2)swap(x1,x2);
	  x1 = x1*2+1, x2 = x2*2+1, y1 = y1*2;
	//cout << x1 << "," << y1 << " " << x2 << "," << y2 << endl;
	  for(int x=x1;x<x2;x+=2)
	    {
	      G[y1][x] = '-';
	      drawO(x,y1);
	    }
	}
      else assert(false);
      //print();
    }

  int x1E,y1E,x2E,y2E;
  cin >> x1E >> y1E >> x2E >> y2E >> xG >> yG;

  
  if(x1E == x2E)
    {
      if(y1E > y2E)swap(y1E,y2E);
      x1E *= 2, y1E = y1E*2 + 1, y2E = y2E*2 + 1;
      G[y1E][x1E] = 'x';
      //for(int y=y1E;y<y2E;y+=2)G[y][x1E] = 'x';
    }
  else if(y1E == y2E)
    {
      if(x1E > x2E)swap(x1E,x2E);
      y1E *= 2, x1E = x1E*2 + 1, x2E = x2E*2 + 1;
      G[y1E][x1E] = 'x';
      //for(int x=x1E;x<x2E;x+=2)G[y1E][x] = 'x';
    }
  
  xS = x1E, yS = y1E;

}

void compute()
{
  int dir = inf;
  rep(i,4)
    {
      int nx = xS + dx[i];
      int ny = yS + dy[i];
      if(!(0 <= nx && nx < 2*W+1 && 0 <= ny && ny < 2*H+1))continue;
      if(G[ny][nx] != 'x')continue;
      dir = i;
    }

  xG = xG*2 + 1;
  yG = yG*2 + 1;
  //cout << "goal = " << xG << "," << yG << endl;
  int cnt = 0;
  bool used[4][2*H+1][2*W+1];
  rep(i,4)rep(j,2*H+1)rep(k,2*W+1)used[i][j][k] = false;

  int x = xS, y = yS;

  while(true)
    {
      //cout << x << "," << y << " " << dir << " " << used[dir][y][x]<< endl;
      if(x == xG && y == yG)
	{
	  cout << cnt << endl;
	  return;
	}
      if(used[dir][y][x])
	{
	  cout << "Impossible" << endl;
	  return;
	}
      used[dir][y][x] = true;

      int nx = x + dx[dir];
      int ny = y + dy[dir];
      int lx = nx + dx[(dir+1)%4];
      int ly = ny + dy[(dir+1)%4];
      //cout << "n = " << nx << "," << ny << " dir = " << dir << endl;
      //cout << "l = " << lx << "," << ly << endl;
      if(!(0 <= nx && nx < 2*W+1 && 0 <= ny && ny < 2*H+1))
	{
	  cout << "Impossible" << endl;
	  return;
	}
      if(G[ny][nx] != 'x')
	{
	  //cout << "in1" << endl;
	  dir = (dir + 3)%4;
	}
      else if(G[ly][lx] == 'x')
	{
	  //cout << "in2" << endl;
	  dir = (dir + 1)%4;
	  x = nx, y = ny;
	  cnt++;
	}
      else 
	{
	  //cout << "in3" << endl;
	  if(G[ly][lx] != 'o')cnt++;
	  x = nx;
	  y = ny;
	}

      /*
      char pc,ppc;
      pc = G[y][x];
      int llx = x + dx[(dir+1)%4];
      int lly = y + dy[(dir+1)%4];

      ppc = G[lly][llx];
      
      G[y][x] = 'B';
      G[lly][llx] = 'H';
      print();
      G[y][x] = pc;
      G[lly][llx] = ppc;
      */
      //cout <<"next -> " << x << "," << y << endl;
    }

}


int main()
{
  while(cin >> W >> H >> N,W|H|N)
    {
      initGraph();
      makeGraph();
      //print();
      compute();
      //cout << xG <<" " << yG  <<endl;
    }
  return 0;
} 

Measured memory_bytes: 1564