There is a matrix A of size x × y filled with integers. For every $i \in [ 1 . . x ]$, $j \in [ 1 . . y ]$ A_{i}, j = y(i - 1) + j. Obviously, every integer from [1..xy] occurs exactly once in this matrix. 

You have traversed some path in this matrix. Your path can be described as a sequence of visited cells a_1, a_2, ..., a_{n} denoting that you started in the cell containing the number a_1, then moved to the cell with the number a_2, and so on.

From the cell located in i-th line and j-th column (we denote this cell as (i, j)) you can move into one of the following cells: (i + 1, j) — only if i < x;  (i, j + 1) — only if j < y;  (i - 1, j) — only if i > 1;  (i, j - 1) — only if j > 1.

Notice that making a move requires you to go to an adjacent cell. It is not allowed to stay in the same cell. You don't know x and y exactly, but you have to find any possible values for these numbers such that you could start in the cell containing the integer a_1, then move to the cell containing a_2 (in one step), then move to the cell containing a_3 (also in one step) and so on. Can you choose x and y so that they don't contradict with your sequence of moves?


-----Input-----

The first line contains one integer number n (1 ≤ n ≤ 200000) — the number of cells you visited on your path (if some cell is visited twice, then it's listed twice).

The second line contains n integers a_1, a_2, ..., a_{n} (1 ≤ a_{i} ≤ 10^9) — the integers in the cells on your path.


-----Output-----

If all possible values of x and y such that 1 ≤ x, y ≤ 10^9 contradict with the information about your path, print NO.

Otherwise, print YES in the first line, and in the second line print the values x and y such that your path was possible with such number of lines and columns in the matrix. Remember that they must be positive integers not exceeding 10^9.


-----Examples-----
Input
8
1 2 3 6 9 8 5 2

Output
YES
3 3

Input
6
1 2 1 2 5 3

Output
NO

Input
2
1 10

Output
YES
4 9



-----Note-----

The matrix and the path on it in the first test looks like this: [Image] 

Also there exist multiple correct answers for both the first and the third examples.

Difficulty: MEDIUM_HARD

Solutions:
n = int(input())
a = [int(i) for i in input().split()]
c = 1
for i in range(1, n):
	if abs(a[i] - a[i - 1]) > 1:
		c = abs(a[i] - a[i - 1])
x3 = 10 ** 9
r = 1
for i in range(n - 1):
	x1 = max(0, a[i] - 1) // c
	y1 = a[i] % c
	if y1 == 0:
		y1 = c
	x2 = max(0, a[i + 1] - 1) // c
	y2 = a[i + 1] % c
	if y2 == 0:
		y2 = c
	if x2 == x1 + 1 and y2 == y1 and (x1 < x3):
		continue
	elif x2 == x1 and y2 == y1 + 1 and (y1 < c):
		continue
	elif x2 == x1 - 1 and y2 == y1 and (x1 > 0):
		continue
	elif x2 == x1 and y2 == y1 - 1 and (y1 > 0):
		continue
	else:
		r = 0
if r == 1:
	print('YES')
	print(x3, c)
else:
	print('NO')


n = int(input())
a = list(map(int, input().split(' ')))
m = a[0]
b = a[0]
x = 1
mas = []
fl = True
for i in range(1, n):
	if a[i] == a[i - 1]:
		fl = False
		break
	if abs(a[i] - a[i - 1]) > 1:
		if x == 1:
			x = abs(a[i] - a[i - 1])
		elif x != abs(a[i] - a[i - 1]):
			fl = False
			break
		if m != b:
			mas.append((m, b))
		m = a[i]
		b = a[i]
	else:
		if a[i] > b:
			b = a[i]
		if a[i] < m:
			m = a[i]
if m != b:
	mas.append((m, b))
for i in range(len(mas)):
	if x != 1:
		if (mas[i][0] - 1) // x != (mas[i][1] - 1) // x:
			fl = False
			break
if fl:
	print('YES')
	print(str(1000000000), str(x))
else:
	print('NO')


n = int(input())
a = [int(x) for x in input().split()]
y = []
for (s, t) in zip(a, a[1:]):
	if abs(s - t) != 1 and s != t:
		y.append(abs(s - t))
y.append(1)
y = y[0]
for (s, t) in zip(a, a[1:]):
	if not (abs(s - t) == y or (abs(s - t) == 1 and min(s, t) % y != 0)):
		break
else:
	print('YES')
	print('{} {}'.format(10 ** 9, y))
	return
print('NO')


while True:
	n = int(input())
	path = list(map(int, input().split()))
	eleminatedY = {1}
	y = 1
	for i in range(n - 1):
		diff = abs(path[i] - path[i + 1])
		if diff == 0:
			print('NO')
			return
		if diff == 1:
			eleminatedY.add(min(path[i], path[i + 1]))
			if min(path[i], path[i + 1]) % y == 0 and y != 1:
				print('NO')
				return
			continue
		if y == diff:
			continue
		for value in eleminatedY:
			if value % diff == 0:
				print('NO')
				return
		if y == 1:
			y = diff
			continue
		print('NO')
		return
	print('YES\n{} {}'.format(1000000000, y))
	return


n = int(input())
a = list(map(int, input().split()))
m = 1
for (l, r) in zip(a, a[1:]):
	if abs(l - r) != 1 and l != r:
		m = abs(l - r)
		break
for (l, r) in zip(a, a[1:]):
	if not (abs(l - r) == m or (abs(l - r) == 1 and min(l, r) % m != 0)):
		print('NO')
		exit()
print('YES')
print('{} {}'.format(10 ** 9, m))


n = int(input())
a = list(map(int, input().split()))
x = 1
for i in range(n - 1):
	if abs(a[i + 1] - a[i]) > x:
		x = abs(a[i + 1] - a[i])
		break
for i in range(n - 1):
	y = abs(a[i + 1] - a[i])
	if y == 1 and (a[i] - 1) % x == 0 and (a[i + 1] < a[i]) and ((a[i + 1] - 1) % x != 0):
		print('NO')
		exit(0)
	elif y == 1 and a[i] % x != 0:
		continue
	elif y == 1 and a[i] % x == 0 and (a[i + 1] >= a[i]) and (a[i + 1] % x != 0):
		print('NO')
		exit(0)
	elif y == 1 and a[i] % x == 0 and (a[i + 1] < a[i] or a[i + 1] % x == 0):
		continue
	elif y == x:
		continue
	else:
		print('NO')
		exit(0)
print('YES')
print(1000000000, x)


import os
import sys
import math
from io import BytesIO, IOBase
from fractions import Fraction
import collections
from itertools import permutations
from collections import defaultdict
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
n = int(input())
l = list(map(int, input().split()))
c = 1
for i in range(1, n):
	if l[i] == l[i - 1]:
		print('NO')
		sys.exit()
	if abs(l[i] - l[i - 1]) != 1:
		if c == 1:
			c = abs(l[i] - l[i - 1])
		elif c != abs(l[i] - l[i - 1]):
			print('NO')
			sys.exit()
if c == 1:
	print('YES')
	print(10 ** 9, c)
	sys.exit()
for i in range(n):
	if i > 0 and (l[i] - 1) % c == 0:
		if l[i - 1] == l[i] - 1:
			print('NO')
			sys.exit()
	if i < n - 1 and (l[i] - 1) % c == 0:
		if l[i + 1] == l[i] - 1:
			print('NO')
			sys.exit()
print('YES')
print(10 ** 9, c)


import math
import heapq, bisect
import sys
from collections import deque, defaultdict
from fractions import Fraction
mod = 10 ** 9 + 7
mod1 = 998244353
import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

class SegmentTree1:

	def __init__(self, data, default='z', func=lambda a, b: min(a, b)):
		self._default = default
		self._func = func
		self._len = len(data)
		self._size = _size = 1 << (self._len - 1).bit_length()
		self.data = [default] * (2 * _size)
		self.data[_size:_size + self._len] = data
		for i in reversed(range(_size)):
			self.data[i] = func(self.data[i + i], self.data[i + i + 1])

	def __delitem__(self, idx):
		self[idx] = self._default

	def __getitem__(self, idx):
		return self.data[idx + self._size]

	def __setitem__(self, idx, value):
		idx += self._size
		self.data[idx] = value
		idx >>= 1
		while idx:
			self.data[idx] = self._func(self.data[2 * idx], self.data[2 * idx + 1])
			idx >>= 1

	def __len__(self):
		return self._len

	def query(self, start, stop):
		if start == stop:
			return self.__getitem__(start)
		stop += 1
		start += self._size
		stop += self._size
		res = self._default
		while start < stop:
			if start & 1:
				res = self._func(res, self.data[start])
				start += 1
			if stop & 1:
				stop -= 1
				res = self._func(res, self.data[stop])
			start >>= 1
			stop >>= 1
		return res

	def __repr__(self):
		return 'SegmentTree({0})'.format(self.data)

class SegmentTree:

	def __init__(self, data, default=0, func=lambda a, b: a * a + b * b):
		self._default = default
		self._func = func
		self._len = len(data)
		self._size = _size = 1 << (self._len - 1).bit_length()
		self.data = [default] * (2 * _size)
		self.data[_size:_size + self._len] = data
		for i in reversed(range(_size)):
			self.data[i] = func(self.data[i + i], self.data[i + i + 1])

	def __delitem__(self, idx):
		self[idx] = self._default

	def __getitem__(self, idx):
		return self.data[idx + self._size]

	def __setitem__(self, idx, value):
		idx += self._size
		self.data[idx] = value
		idx >>= 1
		while idx:
			self.data[idx] = self._func(self.data[2 * idx], self.data[2 * idx + 1])
			idx >>= 1

	def __len__(self):
		return self._len

	def query(self, start, stop):
		if start == stop:
			return self.__getitem__(start)
		stop += 1
		start += self._size
		stop += self._size
		res = self._default
		while start < stop:
			if start & 1:
				res = self._func(res, self.data[start])
				start += 1
			if stop & 1:
				stop -= 1
				res = self._func(res, self.data[stop])
			start >>= 1
			stop >>= 1
		return res

	def __repr__(self):
		return 'SegmentTree({0})'.format(self.data)

class Factorial:

	def __init__(self, MOD):
		self.MOD = MOD
		self.factorials = [1, 1]
		self.invModulos = [0, 1]
		self.invFactorial_ = [1, 1]

	def calc(self, n):
		if n <= -1:
			print('Invalid argument to calculate n!')
			print('n must be non-negative value. But the argument was ' + str(n))
			exit()
		if n < len(self.factorials):
			return self.factorials[n]
		nextArr = [0] * (n + 1 - len(self.factorials))
		initialI = len(self.factorials)
		prev = self.factorials[-1]
		m = self.MOD
		for i in range(initialI, n + 1):
			prev = nextArr[i - initialI] = prev * i % m
		self.factorials += nextArr
		return self.factorials[n]

	def inv(self, n):
		if n <= -1:
			print('Invalid argument to calculate n^(-1)')
			print('n must be non-negative value. But the argument was ' + str(n))
			exit()
		p = self.MOD
		pi = n % p
		if pi < len(self.invModulos):
			return self.invModulos[pi]
		nextArr = [0] * (n + 1 - len(self.invModulos))
		initialI = len(self.invModulos)
		for i in range(initialI, min(p, n + 1)):
			next = -self.invModulos[p % i] * (p // i) % p
			self.invModulos.append(next)
		return self.invModulos[pi]

	def invFactorial(self, n):
		if n <= -1:
			print('Invalid argument to calculate (n^(-1))!')
			print('n must be non-negative value. But the argument was ' + str(n))
			exit()
		if n < len(self.invFactorial_):
			return self.invFactorial_[n]
		self.inv(n)
		nextArr = [0] * (n + 1 - len(self.invFactorial_))
		initialI = len(self.invFactorial_)
		prev = self.invFactorial_[-1]
		p = self.MOD
		for i in range(initialI, n + 1):
			prev = nextArr[i - initialI] = prev * self.invModulos[i % p] % p
		self.invFactorial_ += nextArr
		return self.invFactorial_[n]

class Combination:

	def __init__(self, MOD):
		self.MOD = MOD
		self.factorial = Factorial(MOD)

	def ncr(self, n, k):
		if k < 0 or n < k:
			return 0
		k = min(k, n - k)
		f = self.factorial
		return f.calc(n) * f.invFactorial(max(n - k, k)) * f.invFactorial(min(k, n - k)) % self.MOD

def powm(a, n, m):
	if a == 1 or n == 0:
		return 1
	if n % 2 == 0:
		s = powm(a, n // 2, m)
		return s * s % m
	else:
		return a * powm(a, n - 1, m) % m

def sort_list(list1, list2):
	zipped_pairs = zip(list2, list1)
	z = [x for (_, x) in sorted(zipped_pairs)]
	return z

def product(l):
	por = 1
	for i in range(len(l)):
		por *= l[i]
	return por

def binarySearchCount(arr, n, key):
	left = 0
	right = n - 1
	count = 0
	while left <= right:
		mid = int((right + left) / 2)
		if arr[mid] <= key:
			count = mid + 1
			left = mid + 1
		else:
			right = mid - 1
	return count

def countdig(n):
	c = 0
	while n > 0:
		n //= 10
		c += 1
	return c

def countGreater(arr, n, k):
	l = 0
	r = n - 1
	leftGreater = n
	while l <= r:
		m = int(l + (r - l) / 2)
		if arr[m] > k:
			leftGreater = m
			r = m - 1
		else:
			l = m + 1
	return n - leftGreater
n = int(input())
l = list(map(int, input().split()))
c = 1
for i in range(1, n):
	if l[i] == l[i - 1]:
		print('NO')
		sys.exit()
	if abs(l[i] - l[i - 1]) != 1:
		if c == 1:
			c = abs(l[i] - l[i - 1])
		elif c != abs(l[i] - l[i - 1]):
			print('NO')
			sys.exit()
if c == 1:
	print('YES')
	print(10 ** 9, c)
	sys.exit()
for i in range(n):
	if i > 0 and (l[i] - 1) % c == 0:
		if l[i - 1] == l[i] - 1:
			print('NO')
			sys.exit()
	if i < n - 1 and (l[i] - 1) % c == 0:
		if l[i + 1] == l[i] - 1:
			print('NO')
			sys.exit()
print('YES')
print(10 ** 9, c)


from sys import stdin, stdout
inp = lambda : (int(o) for o in stdin.readline().split())
n = int(input())
a = list(inp())
(ans, c) = (1, [])
b = [1]
for i in range(n - 1):
	s = abs(a[i] - a[i + 1])
	if s == 1:
		c.append(max(a[i], a[i + 1]))
		continue
	if s == 0:
		exit(print('NO'))
	elif s > 1:
		b.append(s)
if len(set(b)) > 2:
	exit(print('NO'))
if b[-1] != 1:
	for i in c:
		if (i - 1) % b[-1] == 0:
			exit(print('NO'))
stdout.write('YES\n')
stdout.write('1000000000 ' + str(b[-1]))


n = int(input())
a = list(map(int, input().split()))
x = 1
y = 10 ** 9
if n == 1:
	print('YES')
	print(y, x)
else:
	t = 0
	for i in range(1, n):
		s = a[i] - a[i - 1]
		if s != 1 and s != -1:
			s = max(s, -s)
			if x != 1 and x != s or s == 0:
				print('NO')
				t = 1
				break
			x = s
	if t == 0 and x > 1:
		for i in range(1, n):
			if a[i] % x == 0 and a[i - 1] == a[i] + 1 or (a[i - 1] % x == 0 and a[i] == a[i - 1] + 1):
				print('NO')
				t = 1
				break
	if t == 0:
		print('YES')
		print(y, x)


MAXN = 1000000000
n = int(input())
a = list(map(int, input().split()))

def solve1():
	for i in range(n - 1):
		if abs(a[i] - a[i + 1]) != 1:
			return False
	print('YES\n%d %d' % (MAXN, 1))
	return True

def solve2():
	w = -1
	for i in range(n - 1):
		d = abs(a[i] - a[i + 1])
		if d != 1:
			if w == -1:
				w = d
			elif w != d:
				return False
	if w <= 0:
		return False
	for i in range(n - 1):
		if abs(a[i] - a[i + 1]) == 1 and (a[i] - 1) // w != (a[i + 1] - 1) // w:
			return False
	print('YES\n%d %d' % (MAXN, w))
	return True
if solve1():
	pass
elif solve2():
	pass
else:
	print('NO')


def sove(n, a):
	m = 1
	for i in range(1, n):
		if abs(a[i] - a[i - 1]) == 0:
			return -1
		if abs(a[i] - a[i - 1]) > 1:
			if m == 1:
				m = abs(a[i] - a[i - 1])
			elif m != 1:
				if abs(a[i] - a[i - 1]) != m:
					return -1
	for i in range(n - 1):
		if a[i] % m == 0:
			if a[i + 1] != a[i] - 1 and a[i + 1] != a[i] - m and (a[i + 1] != a[i] + m):
				return -1
		elif a[i] % m == 1:
			if a[i + 1] != a[i] + 1 and a[i + 1] != a[i] - m and (a[i + 1] != a[i] + m):
				return -1
	return [10 ** 9, m]
n = int(input())
a = list(map(int, input().split()))
p = sove(n, a)
if p == -1:
	print('NO')
else:
	print('YES')
	print(*p)


import sys, math
n = int(input())
a = [int(i) for i in sys.stdin.readline().split()]
b = [1]
c = []
for i in range(n - 1):
	m = abs(a[i] - a[i + 1])
	if m == 0:
		sys.stdout.write('NO')
		exit(0)
	if m not in b and len(b) == 2:
		sys.stdout.write('NO')
		exit(0)
	elif m == 1:
		c.append(max(a[i], a[i + 1]))
	else:
		b.append(m)
k = max(b)
if k != 1:
	for i in c:
		if (i - 1) % k == 0:
			sys.stdout.write('NO')
			exit(0)
sys.stdout.write('YES\n')
sys.stdout.write('1000000000 ' + str(max(b)))


import os
import sys
from collections import *
from bisect import *
from io import BytesIO, IOBase

def vsInput():
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
ALPHA = 'abcdefghijklmnopqrstuvwxyz/'
M = 1000000007
EPS = 1e-06

def Ceil(a, b):
	return a // b + int(a % b > 0)

def value():
	return tuple(map(int, input().split()))

def array():
	return [int(i) for i in input().split()]

def Int():
	return int(input())

def Str():
	return input()

def arrayS():
	return [i for i in input().split()]
n = Int()
a = array()
x = 10 ** 9
y = 1
for i in range(1, n):
	if abs(a[i] - a[i - 1]) > 1:
		y = abs(a[i] - a[i - 1])
ok = True
for i in range(1, n):
	row1 = Ceil(a[i], y)
	row2 = Ceil(a[i - 1], y)
	if row1 == row2:
		if abs(a[i] - a[i - 1]) != 1:
			ok = False
	else:
		if abs(row2 - row1) != 1:
			ok = False
		if a[i] % y != a[i - 1] % y:
			ok = False
if ok:
	print('YES')
	print(x, y)
else:
	print('NO')


n = int(input())
path = [int(r) for r in input().split()]
row_len = 1
for i in range(1, len(path)):
	ap = abs(path[i] - path[i - 1])
	if ap != 1 and ap != 0:
		row_len = ap
		break
path = [x - 1 for x in path]
for i in range(1, len(path)):
	start_x = path[i - 1] // row_len
	start_y = path[i - 1] % row_len
	end_x = path[i] // row_len
	end_y = path[i] % row_len
	ax = abs(start_x - end_x)
	ay = abs(start_y - end_y)
	if ax > 1 or ay > 1 or ax == ay:
		print('NO')
		exit()
print('YES')
print('1000000000 ' + str(row_len))


n = int(input())
walk = list(map(int, input().split()))
MAXN = 1000000000

def solve1():
	for i in range(n - 1):
		if abs(walk[i + 1] - walk[i]) != 1:
			return False
	print('YES')
	print(MAXN, 1)
	return True

def solve2():
	colum = -1
	for i in range(n - 1):
		diff = abs(walk[i + 1] - walk[i])
		if diff != 1:
			if colum == -1:
				colum = diff
			elif colum != diff:
				return False
	if colum <= 0:
		return False
	for i in range(n - 1):
		if abs(walk[i + 1] - walk[i]) == 1 and (walk[i + 1] - 1) // colum != (walk[i] - 1) // colum:
			return False
	print('YES')
	print(MAXN, colum)
	return True
if solve1():
	pass
elif solve2():
	pass
else:
	print('NO')


n = int(input())
A = [int(x) - 1 for x in input().split()]
stay_at_cell = any([A[i] == A[i + 1] for i in range(n - 1)])
found = False
for i in range(n - 1):
	if abs(A[i] - A[i + 1]) != 1:
		found = True
		y = abs(A[i] - A[i + 1])
if stay_at_cell:
	print('NO')
elif not found:
	print('YES')
	print(10 ** 9, 1)
else:
	is_ok = True
	for i in range(len(A) - 1):
		neighbours = []
		if A[i] >= y:
			neighbours += [A[i] - y]
		neighbours += [A[i] + y]
		if A[i] % y != 0:
			neighbours += [A[i] - 1]
		if A[i] % y != y - 1:
			neighbours += [A[i] + 1]
		is_ok = is_ok and A[i + 1] in neighbours
	if is_ok:
		print('YES')
		print(10 ** 9, y)
	else:
		print('NO')


n = int(input())
a = list(map(int, input().split()))
y = 1
for i in range(1, n):
	if y == 1 and abs(a[i] - a[i - 1]) != 1:
		y = abs(a[i] - a[i - 1])
	if abs(a[i] - a[i - 1]) not in [y, 1]:
		print('NO')
		exit(0)
if y == 1:
	print('YES')
	print(10 ** 9, y)
	exit(0)
if y == 0:
	print('NO')
	exit(0)
x = 10 ** 9
xx = a[0] // y + int(a[0] % y != 0)
yy = a[0] - y * (xx - 1)
for i in range(1, n):
	(xxx, yyy) = (xx, yy)
	to = []
	if xx + 1 <= x and y * xx + yy == a[i]:
		xx += 1
	elif xx - 1 >= 1 and y * (xx - 2) + yy == a[i]:
		xx -= 1
	elif yy + 1 <= y and y * (xx - 1) + yy + 1 == a[i]:
		yy += 1
	elif yy - 1 >= 1 and y * (xx - 1) + yy - 1 == a[i]:
		yy -= 1
	if xxx == xx and yyy == yy:
		print('NO')
		exit(0)
print('YES')
print(x, y)


n = int(input())
a = list(map(int, input().split()))
ans = 1
s = set()
for i in range(n - 1):
	if abs(a[i + 1] - a[i]) != 1:
		s.add(abs(a[i + 1] - a[i]))
if ans == -1 or len(s) > 1 or 0 in s:
	print('NO')
else:
	if len(s) > 0:
		ans = s.pop()
	for i in range(n - 1):
		a1 = min(a[i], a[i + 1])
		a2 = max(a[i], a[i + 1])
		if a2 - a1 == 1 and a1 % ans == 0 and (ans != 1):
			ans = -1
			break
	if ans == -1:
		print('NO')
	else:
		print('YES')
		print(10 ** 9, ans)