At the national IP office of the country. These are Ukrpatent, Rospatent, the US Patent and Trademark Office. You can patent at the regional office. For example, the Eurasian Patent Organization, the African Intellectual Property Organization