Need Help For User-finding Program

Hello, how are you? Any help? I am designing a program to move between cities, where the user chooses two cities and the application searches for the values that are equal in the firebase database. When it finds an equal value, it shows the name, phone number and all information related to this person

Download the entire database and look for that pair of values.

Here an example:

You can setup indexes in your firebase rules, in order to be able to run a query on those indexes:

https://firebase.google.com/docs/database/security/indexing-data