input: Write a Python function to determine the maximum length of a chain that can be created from a given list of pairs.
  assert max_chain_length([Pair(5, 24), Pair(15, 25), Pair(27, 40), Pair(50, 60)], 4) == 3
  assert max_chain_length([Pair(1, 2), Pair(3, 4), Pair(5, 6), Pair(7, 8)], 4) == 4
  assert max_chain_length([Pair(19, 10), Pair(11, 12), Pair(13, 14), Pair(15, 16), Pair(31, 54)], 5) == 5
output: def max_chain_length(pairs, n):
      pairs.sort(key=lambda x: x.second)
      max_len = 0
      current_end = float('-inf')
      for pair in pairs:
          if pair.first > current_end:
              max_len += 1
              current_end = pair.second
      return max_len