#include <iostream>
#include <cstring>

using namespace std;

const int dx[] = { 1, 0, -1, 0 };
const int dy[] = { 0, 1, 0, -1 };
bool field[201][201];

int main(){
	while(true){
		int W, H, N;
		cin >> W >> H >> N;
		if(W == 0 && H == 0 && N == 0){ break; }
		memset(field, 0, sizeof(field));
		for(int i = 0; i <= H * 2; ++i){
			field[i][0] = field[i][W * 2] = true;
		}
		for(int i = 0; i <= W * 2; ++i){
			field[0][i] = field[H * 2][i] = true;
		}
		while(N--){
			int x1, y1, x2, y2;
			cin >> x1 >> y1 >> x2 >> y2;
			if(x1 != x2){
				if(x2 < x1){ swap(x1, x2); }
				for(int i = x1 * 2; i <= x2 * 2; ++i){
					field[y1 * 2][i] = true;
				}
			}else{
				if(y2 < y1){ swap(y1, y2); }
				for(int i = y1 * 2; i <= y2 * 2; ++i){
					field[i][x1 * 2] = true;
				}
			}
		}
		int xe1, ye1, xe2, ye2, xg, yg, xs, ys;
		cin >> xe1 >> ye1 >> xe2 >> ye2 >> xg >> yg;
		xg = xg * 2 + 1; yg = yg * 2 + 1;
		int dir = 0;
		if(xe1 != xe2){
			xs = min(xe1, xe2) * 2 + 1;
			if(ye1 == 0){
				ys = 0;
				dir = 1;
			}else{
				ys = (H * 2);
				dir = 3;
			}
		}else{
			ys = min(ye1, ye2) * 2 + 1;
			if(xe1 == 0){
				xs = 0;
				dir = 0;
			}else{
				xs = (W * 2);
				dir = 2;
			}
		}
		field[ys][xs] = false;
		int x = xs, y = ys, answer = 0;
		while(true){
			int nx = x + dx[dir], ny = y + dy[dir];
			while(field[ny][nx]){
				dir = (dir - 1) & 3;
				nx = x + dx[dir], ny = y + dy[dir];
			}
			if(!field[ny + dy[(dir + 1) & 3]][nx + dx[(dir + 1) & 3]]){
				dir = (dir + 1) & 3;
			}
			x = nx; y = ny;
			if((x & 1) == 1 && (y & 1) == 1){ ++answer; }
			if(x == xs && y == ys){
				answer = -1;
				break;
			}else if(x == xg && y == yg){
				break;
			}
		}
		if(answer < 0){
			cout << "Impossible" << endl;
		}else{
			cout << answer << endl;
		}
	}
	return 0;
}