Based on pigeonhole principle.
You want minimum number of pairs (a,b) to ensure such that
(a1,b1) (a2,b2) pairs exist in a way
a1=a2mod5 and b1=b2mod5
In a pair(a,b)
a can belong to any of the residue of mod 5(0,1,2,3,4)-Total of 5 values.
Similarly b can take a total of 5 values.
Since a and b can be selected independently, a maximum of total 25(5x5) ordered pairs can be there which can sure that IN NO WAY two pair will exist such that,
(a1,b1) (a2,b2)
a1=a2mod5 and b1=b2mod5
but now since, you have exhausted all the possibilities to make any new pair,now if you make one extra pair, it is guaranteed to have been repeated from the set of 25 ordered pairs formed above.
Hence, you need minimum 26 ordered pairs to ensure that
(a1,b1) (a2,b2) pairs exist in a way
a1=a2mod5 and b1=b2mod5