// Arup Guha
// 9/29/2013
// Solution to 2010 Arab Programming Contest Problem G: Knights
// Note: Uses my solution for the knight jumping distance problem from the 2011 UCF Local Contest.

import java.util.*;

public class g {

	final static long UNFILLED = -1L;

	public static void main(String[] args) {

		Scanner stdin = new Scanner(System.in);
		int n = stdin.nextInt();
		int loop = 1;

		// Go through each case.
		while (n != 0) {

			// Read in board positions for knights.
			long[][] knights = new long[n][2];
			for (int i=0; i<n; i++) {
				knights[i][0] = stdin.nextLong();
				knights[i][1] = stdin.nextLong();
			}

			// And where they must end up.
			long[][] spots = new long[n][2];
			for (int i=0; i<n; i++) {
				spots[i][0] = stdin.nextLong();
				spots[i][1] = stdin.nextLong();
			}

			// Get distances to each spot.
			long[][] adj = new long[n][n];
			for (int i=0; i<n; i++) {
				for (int j=0; j<n; j++) {
					knight prob = new knight(knights[i][0], knights[i][1], spots[j][0], spots[j][1]);
					adj[i][j] = prob.solve();
				}
			}

			// Run iterative DP here.
			System.out.println(loop+". "+solveDP(adj));
			n = stdin.nextInt();
			loop++;
		}
	}

	public static long solveDP(long[][] adj) {

		int n = adj.length;
		long[] dp = new long[1 << n];
		Arrays.fill(dp, UNFILLED);
		dp[0] = 0;

		for (int i=1; i<dp.length; i++) {
			int bits = Integer.bitCount(i);

			// Try building off knight j.
			for (int j=0; j<n; j++) {

				// This knight is in the set, so try it.
				if (((1 << j)  & i) != 0) {

					// Here we try the old subset plus moving knight j to the last slot, bits-1.
					long ans = dp[i - (1 << j)] + adj[j][bits-1];
					if (dp[i] == UNFILLED || ans < dp[i])
						dp[i] = ans;
				}
			}
		}

		return dp[dp.length-1];
	}
}

class knight {

	public long r1;
	public long c1;
	public long r2;
	public long c2;

	public knight(long sr, long sc, long er, long ec) {

		r1 = sr;
		c1 = sc;
		r2 = er;
		c2 = ec;

		if (r1 > r2) {
			long tmp = r1;
			r1 = r2;
			r2 = tmp;
		}
		if (c1 > c2) {
			long tmp = c1;
			c1 = c2;
			c2 = tmp;
		}

		// Reflect across y = x.
		if (r2 - r1 > c2 - c1) {
			long tmp = r1;
			r1 = c1;
			c1 = tmp;
			tmp = r2;
			r2 = c2;
			c2 = tmp;
		}
	}

	public long solve() {

		long dx = r2-r1;
		long dy = c2-c1;
		long sum = dx+dy;

		ArrayList<pair> targets = new ArrayList<pair>();
		targets.add(new pair(r1,c1));

		// Close so just do a bfs.
		if (sum < 10)
			return bfs(targets);

		// Long rectangle.
		if (dy >= 2*dx) {

			// We basically take 2 hops at a time moving up 4 columns. Our row can be any even numbered
			// offset that we desire, since it's a long rectangle. I add in two rows of squares to our
			// possible targets.
			long doublehops = dy/4-1;
			long newc = 4*doublehops + c1;

			for (long newr=r2-dx%2; newr>=r2-10; newr-=2)
				targets.add(new pair(newr, newc));

			for (long newr=r2-1+dx%2; newr>=r2-10; newr-=2)
				targets.add(new pair(newr, newc-1));

			return doublehops*2 + bfs(targets);
		}
		else {

			long doublehops = (dx+dy)/6 - 1;
			long totalSteps = 6*doublehops;

			// Here our strategy is that we can move 6 spots in 2 moves anywhere with slope >= 1 and <= 2.
			// So I come within 6 spots of the target and add all of these points that clip the rectangle.
			for (int i=0;; i++) {
				long newc = c2 - i;
				long newr = r1 + (totalSteps - (dy-i));
				targets.add(new pair(newr, newc));
				if (newr >= r2) break;
			}

			return doublehops*2 + bfs(targets);
		}
	}

	// Returns the minimum distance from (r2, c2) to any item listed in targets.
	public long bfs(ArrayList<pair> targets) {

		HashMap<String,Long> map = new HashMap<String,Long>();
		LinkedList<pair> q = new LinkedList<pair>();

		// Set up BFS.
		pair start = new pair(r2,c2);
		q.offer(start);
		map.put(start.toString(), 0L);

		// Defines the knight hops.
		int[] kdx = {-2,-2,-1,-1, 1, 1,  2, 2};
		int[] kdy = {-1, 1,-2, 2,-2, 2, -1, 1};

		// We'll return later.
		while (true) {

			// Get the next item.
			pair next = q.poll();

			// See if we're done!
			if (in(next, targets))
				return map.get(next.toString());

			// Try adding each neighbor.
			for (int i=0; i<kdx.length; i++) {

				pair newpair = new pair(next.r+kdx[i], next.c+kdy[i]);

				// Only add if we've never been here before AND it's inbounds.
				if (!map.containsKey(newpair.toString())) {
					q.offer(newpair);
					map.put(newpair.toString(), map.get(next.toString())+1);
				}
			}
		}
	}

	// Returns true iff p is in items.
	public static boolean in(pair p, ArrayList<pair> items) {
		for (int i=0; i<items.size(); i++)
			if (p.equals(items.get(i)))
				return true;
		return false;
	}
}

class pair {

	public long r;
	public long c;

	public pair(long a, long b) {
		r = a;
		c = b;
	}

	public boolean equals(pair other) {
		return r == other.r && c == other.c;
	}

	public boolean inbounds(long size) {
		return r >= 0 && c >= 0 && r < size && c < size;
	}

	public String toString() {
		return ""+r+","+c;
	}
}