2
5 2
1 2
4 5
5 3
1 2
2 3
4 5
2
1
In the first sub-test case, it is optimal to connect fields 2 and 3 with a path, and fields 3 and 4 with a path.
In the second sub-test case, it is optimal to connect fields 3 and 4 with a path. No second path is needed.