You are a traveler, lost in a jungle. Backtrack your steps and find the starting point. 
Currently, you are at coordinates (x,y). You are also given an array pathCoordinates [ ] where each element is a (a,b) pair. 
The i^{th} pair (a,b), in the array, denotes that in the i^{th} move you moved your X co-ordinate by a and Y co-ordinate by b. 
if X,Y coordinates in an instant are (c,d) then your next move will be to ( c+a, d+b). 
Example 1:
Input: x = 2, y = 2, 
pathCoordinates = {{1,0},{0,1},{1,1}}
Output: {0,0}
Explaination:
{0,0} was the starting point of the traveler.
At first he changed his X co-ordinate by 1 and
Y co-ordinate by 0.
{0,0} -> {1,0}
After that he changed his X co-ordinate by 0 and
Y co-ordinate by 1.
{0,0} -> {1,0} -> {1,1}
And finally, he changed his X co-ordinate by 1 and
Y co-ordinate by 1.
{0,0} -> {1,0} -> {1,1} -> {2,2}
Example 2:
Input: x = 1, y = 2,
pathCoordinates = {{1,1}}
Output: {0,1}
Explaination:
The route followed by the traveller is
{0,1} -> {1,2}.
 
Your Task:
You don't need to read or print anything. Your task is to complete the function findStartingPoint() which takes x, y, and pathCoordinates as input parameters and returns a list containing the starting point.
 
Expected Time Compelxity: O(n) where n = length of pathCoordinates.
Expected Space Complexity: O(1)
 
Constraints:
1 <= n <= 10^{3}

Difficulty: EASY
Tags: Matrices

Data structures
Skill types: Data structures
Expected Time Complexity: O(n) where n = length of pathCoordinates
Expected Auxiliary Space: O(1)

Starter code:
#User function Template for python3

class Solution:
	def findStartingPoint(self, x, y, pathCoordinates):
		#Code here

Solutions:
class Solution:

	def findStartingPoint(self, x, y, pathCoordinates):
		for i in pathCoordinates:
			x -= i[0]
			y -= i[1]
		return [x, y]


class Solution:

	def findStartingPoint(self, x, y, path):
		for i in range(len(path) - 1, -1, -1):
			x -= path[i][0]
			y -= path[i][1]
		return (x, y)


class Solution:

	def findStartingPoint(self, x, y, pathCoordinates):
		n = len(pathCoordinates)
		for i in range(n):
			x -= pathCoordinates[i][0]
			y -= pathCoordinates[i][1]
		return [x, y]


class Solution:

	def findStartingPoint(self, x, y, pathCoordinates):
		summ = 0
		result_list = []
		for j in range(0, 2):
			for i in range(0, n):
				summ += pathCoordinates[i][j]
			if j == 0:
				result_list.append(x - summ)
			if j == 1:
				result_list.append(y - summ)
			summ = 0
		return result_list


class Solution:

	def findStartingPoint(self, x, y, pathCoordinates):
		for (a, b) in pathCoordinates:
			x -= a
			y -= b
		return (x, y)


class Solution:

	def findStartingPoint(self, x, y, pathCoordinates):
		x_t = 0
		y_t = 0
		for i in range(len(pathCoordinates)):
			x_t += pathCoordinates[i][0]
			y_t += pathCoordinates[i][1]
		return [x - x_t, y - y_t]


class Solution:

	def findStartingPoint(self, x, y, pathCoordinates):
		xs = 0
		ys = 0
		for i in range(len(pathCoordinates)):
			xs += pathCoordinates[i][0]
			ys += pathCoordinates[i][1]
		xco = x - xs
		yco = y - ys
		return (xco, yco)


class Solution:

	def findStartingPoint(self, x, y, pathCoordinates):
		xs = 0
		ys = 0
		for i in range(len(pathCoordinates)):
			xs += pathCoordinates[i][0]
			ys += pathCoordinates[i][1]
		xco = x - xs
		yco = y - ys
		return (xco, yco)
if __name__ == '__main__':
	T = int(input())
	for i in range(T):
		(x, y) = input().split()
		x = int(x)
		y = int(y)
		n = int(input())
		pathCoordinates = []
		for _ in range(n):
			pathCoordinates.append(list(map(int, input().split())))
		obj = Solution()
		ans = obj.findStartingPoint(x, y, pathCoordinates)
		for _ in ans:
			print(_, end=' ')
		print()


class Solution:

	def findStartingPoint(self, x, y, pathCoordinates):
		summ = 0
		result_list = []
		for j in range(0, 2):
			for i in range(0, n):
				summ += pathCoordinates[i][j]
			if j == 0:
				result_list.append(x - summ)
			if j == 1:
				result_list.append(y - summ)
			summ = 0
		return result_list
if __name__ == '__main__':
	T = int(input())
	for i in range(T):
		(x, y) = input().split()
		x = int(x)
		y = int(y)
		n = int(input())
		pathCoordinates = []
		for _ in range(n):
			pathCoordinates.append(list(map(int, input().split())))
		obj = Solution()
		ans = obj.findStartingPoint(x, y, pathCoordinates)
		for _ in ans:
			print(_, end=' ')
		print()


class Solution:

	def findStartingPoint(self, x, y, pathCoordinates):
		sum_x = 0
		sum_y = 0
		for i in range(len(pathCoordinates)):
			sum_x += pathCoordinates[i][0]
			sum_y += pathCoordinates[i][1]
		l = [x - sum_x, y - sum_y]
		return l
if __name__ == '__main__':
	T = int(input())
	for i in range(T):
		(x, y) = input().split()
		x = int(x)
		y = int(y)
		n = int(input())
		pathCoordinates = []
		for _ in range(n):
			pathCoordinates.append(list(map(int, input().split())))
		obj = Solution()
		ans = obj.findStartingPoint(x, y, pathCoordinates)
		for _ in ans:
			print(_, end=' ')
		print()


class Solution:

	def findStartingPoint(self, x, y, pathCoordinates):
		pathCoordinates.reverse()
		for (i, j) in pathCoordinates:
			x -= i
			y -= j
		return (x, y)
if __name__ == '__main__':
	T = int(input())
	for i in range(T):
		(x, y) = input().split()
		x = int(x)
		y = int(y)
		n = int(input())
		pathCoordinates = []
		for _ in range(n):
			pathCoordinates.append(list(map(int, input().split())))
		obj = Solution()
		ans = obj.findStartingPoint(x, y, pathCoordinates)
		for _ in ans:
			print(_, end=' ')
		print()


class Solution:

	def findStartingPoint(self, x, y, pathCoordinates):
		(start_x, start_y) = (x, y)
		for i in range(len(pathCoordinates) - 1, -1, -1):
			start_x -= pathCoordinates[i][0]
			start_y -= pathCoordinates[i][1]
		return [start_x, start_y]


class Solution:

	def findStartingPoint(self, x, y, pathCoordinates):
		a = 0
		b = 0
		n = len(pathCoordinates)
		m = len(pathCoordinates[0])
		for i in range(n):
			for j in range(m):
				if j == 0:
					a -= pathCoordinates[i][j]
				else:
					b -= pathCoordinates[i][j]
		a += x
		b += y
		return [a, b]


class Solution:

	def findStartingPoint(self, x, y, pathCoordinates):
		s1 = 0
		s2 = 0
		for i in pathCoordinates:
			s1 += i[0]
			s2 += i[1]
		li = [x - s1, y - s2]
		return li