You have records of employee name as string (E_{name}) and salary as positive integer (S). You have to sort the records on the basis of employee salary, if salary is same then use employee name for comparison.
Example 1:
Input: N = 2
arr[] = {{xbnnskd, 100}, {geek, 50}}
Output: {geek 50}, {xbnnskd 100}
Explanation: geek has lowest salary 
as 50 and xbnnskd has more salary.
Example 2: 
Input: N = 2
arr[] = {{shyam, 50}, {ram, 50}} 
Output: ram 50 shyam 50
Your Task:
This is a function problem. You don't need to take any input, as it is already accomplished by the driver code. You just need to complete the function sortRecords() that takes array arr[] and integer N as parameters and sort the array according to the above-given conditions. The function does not return anything.
 
Expected Time Complexity: O(NlogN).
Expected Auxiliary Space: O(1).
 
Constraints:
1 ≤ N ≤ 10^{3}

Difficulty: EASY
Tags: String algorithms

Sorting

Data structures
Skill types: Sorting

Data structures
Expected Time Complexity: O(NlogN).
Expected Auxiliary Space: O(1).

Starter code:
#User function Template for python3





class Solution:

    def sortRecords(self, a, n):

        # Your code goes here

    

Solutions:
class Solution:

	def sortRecords(self, a, n):
		a.sort(key=lambda a: a[0])
		a.sort(key=lambda a: a[1])


class Solution:

	def sortRecords(self, a, n):
		a.sort(key=lambda p: p[0])
		a.sort(key=lambda l: l[1])
		return a


class Solution:

	def sortRecords(self, a, n):
		a.sort()
		a.sort(key=lambda a: a[1])
		return a


class Solution:

	def sortRecords(self, a, n):
		salary = [[y, x] for (x, y) in a]
		salary.sort()
		salary = [[y, x] for (x, y) in salary]
		for i in range(n):
			a[i] = salary[i]


class Solution:

	def sortRecords(self, arr, n):
		arr.sort(key=lambda x: (x[1], x[0]))
		return arr


class Solution:

	def sortRecords(self, a, n):
		if len(a) > 1:
			m = len(a) // 2
			L = a[:m]
			R = a[m:]
			self.sortRecords(L, len(L))
			self.sortRecords(R, len(R))
			i = j = k = 0
			while i < len(L) and j < len(R):
				if L[i][1] < R[j][1]:
					a[k] = L[i]
					i += 1
				elif L[i][1] == R[j][1]:
					if L[i][0] < R[j][0]:
						a[k] = L[i]
						i += 1
					else:
						a[k] = R[j]
						j += 1
				else:
					a[k] = R[j]
					j += 1
				k += 1
			while i < len(L):
				a[k] = L[i]
				i += 1
				k += 1
			while j < len(R):
				a[k] = R[j]
				k += 1
				j += 1


class Solution:

	def sortRecords(self, a, n):
		a.sort()
		a.sort(key=lambda x: x[1])


def mergesort(arr):
	if len(arr) > 1:
		mid = len(arr) // 2
		left = arr[:mid]
		right = arr[mid:]
		mergesort(left)
		mergesort(right)
		l = r = k = 0
		while l < len(left) and r < len(right):
			if left[l][1] == right[r][1]:
				if left[l][0] < right[r][0]:
					arr[k] = left[l]
					l += 1
				elif left[l][0].lower() > right[r][0]:
					arr[k] = right[r]
					r += 1
				elif left[l][0] == right[r][0]:
					arr[k] = left[l]
					l += 1
					r += 1
			elif left[l][1] < right[r][1]:
				arr[k] = left[l]
				l += 1
			elif left[l][1] > right[r][1]:
				arr[k] = right[r]
				r += 1
			k += 1
		while l < len(left):
			arr[k] = left[l]
			l += 1
			k += 1
		while r < len(right):
			arr[k] = right[r]
			r += 1
			k += 1

class Solution:

	def sortRecords(self, a, n):
		mergesort(a)
		return a


import operator

class Solution:

	def sortRecords(self, a, n):
		a.sort(key=lambda a: a[0])
		return a.sort(key=lambda a: a[1])


def func(x):
	return x[-1]

def func1(x):
	return x[0]

class Solution:

	def sortRecords(self, a, n):
		a.sort(key=func1)
		a.sort(key=func)
		return a


class Solution:

	def sortRecords(self, a, n):
		temp = []
		for i in range(len(a)):
			l = [a[i][1], a[i][0]]
			temp.append(l)
		temp.sort()
		for i in range(len(a)):
			a[i][0] = temp[i][1]
			a[i][1] = temp[i][0]


class Solution:

	def sortRecords(self, a, n):

		def fun1(elem):
			return elem[0]

		def fun2(elem):
			return elem[1]
		a.sort(key=fun1)
		a.sort(key=fun2)


class Solution:

	def sortRecords(self, a, n):
		a[:] = sorted(a, key=lambda x: x[0])
		a[:] = sorted(a, key=lambda x: x[1])
		return