ORM query: get the related value in one table from the foreign key in another AND print it in the template

I have 3 interrelated tables:

Photos table: id   ship_id  etc
Ships  table: id   price m2 address_id etc
Address table: country region etc

I wrote this query below and it prints me out everything (price, m2 etc) from Ships but when I try to get the country and region from Address via the address_id it prints me the country and region that matches in number the ID of ships table, not the address_id of its column, So it gets me the wrong country.

builts = Photos.objects.select_related("ships", "ships__address")
** NOTE ** using prefetch_related returns the same results, does not make any difference here.

 {% for x in builts %}
                      <tr>
                          <td><a href="{% url 'detailview' id=x.builtproperties.id property_type=x.builtproperties.property_type%}"><div>
                              <img src={{x.images.url}} width="190" height="110"></div></a></td>
                          <td><div> {{x.ships.address.country}}</div></td># wrong 
                          <td><div> {{x.ships.address.region}}</div></td>#wrong                          
                          <td><div> {{x.ships.price}}</div></td>#correct
                          <td><div> {{x.ships.m2}}</div></td>#correct

It would help if you actually posted the models here. It’s difficult to identify specific template issue without.

Side note: The two functions select_releated and prefetch_related have nothing to do with the functionality of making references to related items. They are performance enhancements only. Using one, the other, or both as appropriate, do not affect how you use the related data elsewhere within your view or template.