# Determining first name and surname from a name pair?

Suppose I'm given a list of name pairs:

[
[ 'John', 'Smith'],
[ 'Alex', 'Gordon'],
...
]


I wish to know (or be given reasonable certainty) which column is the surname, and which is the first name, assuming that all columns are consistent, and each name pair consists of exactly one first name and one surname.

An obvious challenge would be checking name pairs where both names can be used as first names, e.g. ['Graham', 'Tyler'].

Is this model something that is reasonable to achieve?

We can find the commonality of the two names in the array using their search function. Then we can say that the name with the higher rank is the first name. For example we can see that for the name ['John', 'Smith'], John has a rank of 27 for the most recent year whereas Smith is not listed. So we can assume that John is the first name and Smith is the last name.