Inject dynamic strings in urls

You have not stated if COUNTRY and CITY are categories, tags or something else. This information would help in giving you a complete answer.

This is just an example of how it can be done.

//Add a location variable to the post type's rewrite rule 
function my_post_type_args( $args, $post_type ) {
  if ( 'my_post_type' == $post_type ) {
      $args['rewrite'] = array(
          'slug' => '/%location%'
      );
  }

  return $args;
}
add_filter( 'register_post_type_args', 'my_post_type_args', 20, 2 );

//Replace the location variable in the url with a country and a city
function my_post_permalinks( $url, $post ){
  if( 'my_post_type' == get_post_type( $post ) ){

    $country = get_the_country(); //implement a function to get the dynamic country
    $city = get_the_city();//implement a function to get the dynamic city

    //Replace the location variable with the country and city
    $url = str_replace('%location%', $country . "https://wordpress.stackexchange.com/" . $city . "https://wordpress.stackexchange.com/", $url );
  }
  return $url;
}
add_filter( 'post_type_link', 'my_post_permalinks' ), 10, 2 );

What you are left to do here is to actually add a rewrite rule to tell WP page to show when www.domain.com/COUNTRY/CITY/contact is accessed.
Because it is not clear from your question what COUNTRY and CITY are I will only point you to the codex for explanation on how to do that.

Once the rewrite rule is added you need to flash WP rewrite rules for it to be used. To do that go to Settings->Permalinks and just click ‘Save Changes’.

With more details in your question maybe it is possible to help you further.

The above code is untested. 🙂