namespace AtCoder; #nullable enable using System.Numerics; static class Extensions { public static T[] Repeat(this int time, Func F) => Enumerable.Range(0, time).Select(_ => F()).ToArray(); } class AtCoder { object? Solve() { var n = Int(); var ax = Int(); var ay = Int(); var bx = Int(); var by = Int(); var cx = Int(); var cy = Int(); var moves = new[]{ (-1, 0), (0, -1), (0, 1), (1, 0) }; var g = new bool[n + 2, n + 2]; for (var i = 1; i <= n; i++) for (var j = 1; j <= n; j++) g[i, j] = true; foreach (var (i, j) in moves) g[cx + i, cy + j] = false; var max = int.MaxValue / 2; var dz = new int[n + 2, n + 2]; for (var i = 1; i <= n; i++) for (var j = 1; j <= n; j++) dz[i, j] = max; dz[bx, by] = 0; var lz = new (int, int)[n + 2, n + 2]; var q = new Queue<(int, int)>(); q.Enqueue((bx, by)); while (dz[ax, ay] == max) { var (x, y) = q.Dequeue(); var nd = dz[x, y] + 1; foreach (var (dx, dy) in moves) { var nx = x + dx; var ny = y + dy; if (!g[nx, ny] || dz[nx, ny] <= nd) continue; dz[nx, ny] = nd; lz[nx, ny] = (x, y); q.Enqueue((nx, ny)); } } var paths = new HashSet<(int, int)>(); { var (x, y) = (ax, ay); while ((x, y) != (bx, by)) { paths.Add((x, y)); (x, y) = lz[x, y]; } paths.Add((x, y)); } var ans = new HashSet<(int, int)>(); foreach (var (x, y) in paths) { foreach (var (i, j) in moves) { var nx = x + i; var ny = y + j; if (Math.Min(nx, ny) == 0 || Math.Max(nx, ny) == n + 1 || paths.Contains((nx, ny))) continue; ans.Add((nx, ny)); } } Out(ans.Count); foreach (var (x, y) in ans) Out(x + " " + y); return null; } public static void Main() => new AtCoder().Run(); public void Run() { var res = Solve(); if (res != null) { if (res is bool yes) res = yes ? "Yes" : "No"; sw.WriteLine(res); } sw.Flush(); } string[] input = Array.Empty(); int iter = 0; readonly StreamWriter sw = new(Console.OpenStandardOutput()) { AutoFlush = false }; string String() { while (iter >= input.Length) (input, iter) = (Console.ReadLine()!.Split(' '), 0); return input[iter++]; } T Input() where T : IParsable => T.Parse(String(), null); int Int() => Input(); void Out(object? x, string? separator = null) { separator ??= Environment.NewLine; if (x is System.Collections.IEnumerable obj and not string) { var firstLine = true; foreach (var item in obj) { if (!firstLine) sw.Write(separator); firstLine = false; sw.Write(item); } } else sw.Write(x); sw.WriteLine(); } }