#C5093. Subarray Detection

    ID: 48704 Type: Default 1000ms 256MiB

Subarray Detection

Subarray Detection

You are given two arrays of integers. Determine whether the second array is a contiguous subarray of the first array.

A subarray of an array A is defined as a segment A[i], A[i+1], \(\ldots\), A[i+m-1] for some index i and length m, where \(0 \leq i \leq n-m\) if \(n\) is the length of A. Note that by definition, an empty array is considered a subarray of any array.

Your task is to print "YES" if the second array appears as a contiguous segment in the first array, and "NO" otherwise.

inputFormat

The input is given from stdin and consists of four lines:

  1. The first line contains an integer \(n\), the number of elements in the first array.
  2. The second line contains \(n\) space-separated integers representing the elements of the first array.
  3. The third line contains an integer \(m\), the number of elements in the second array.
  4. The fourth line contains \(m\) space-separated integers representing the elements of the second array. If \(m = 0\), this line may be empty.

outputFormat

Output a single line to stdout containing either "YES" if the second array is a subarray of the first array, or "NO" if it is not.

## sample
7
1 2 3 4 5 6 7
3
3 4 5
YES