import java.util.Scanner; public class SymmetryChecker { static boolean match(int a, int b) { return a == b || a == -1 || b == -1; } static boolean hasSubstrWithAtMostHalfMismatch(int[] text, int[] pattern) { int mismatch = 0; int n = pattern.length; for (int i = 0; i <= text.length - n; i++) { //temp_i = i; for (int j = 0; j < n; j++) { //System.out.printf("%d %d %s\n", text[i+j], pattern[j], match(text[i + j], pattern[j])?"true":"false"); if (!match(text[i + j], pattern[j])) { mismatch++; if (mismatch > (n/2 -1 )) break; } } if (mismatch <= (n/2 - 1)) return true; mismatch = 0; } return false; } static boolean existsCentrallySymmetricRotation(int[] A) { int N = A.length / 2; int[] revA = new int[2 * N]; for (int i = 0; i < 2 * N; i++) { revA[i] = A[2 * N - 1 - i]; } int[] AA = new int[4 * N]; for (int i = 0; i < 2 * N; i++) { AA[i] = A[i]; AA[i + 2 * N] = A[i]; } return hasSubstrWithAtMostHalfMismatch(AA, revA); } public static void main(String[] args) { Scanner sc = new Scanner(System.in); int len = 2 * sc.nextInt(); int[] A = new int[len]; for (int i = 0; i < len; i++) { A[i] = sc.nextInt(); } boolean result = existsCentrallySymmetricRotation(A); System.out.println(result ? "Yes" : "No"); } }