% There are three houses in a row on street. Each house is inhabited
%  by a man of a different nationality, who has a different pet, and
%  drinks a different beverage.
% The Spaniard own a dog.
% The Ukranian drinks tea.
% The man in the middle house drinks milk.
% The Norwegian lives next to the tea drinker.
% The juice drinker owns a fox.

house(h1).
house(h2).
house(h3).
next(h1,h2).
next(h2,h3).
next(h2,h1).
next(h3,h2).

milk(H):-house(H).
tea(H):-house(H).
juice(H):-house(H).
dog(H):-house(H).
fox(H):-house(H).
zebra(H):-house(H).
spaniard(H):-house(H).
ukranian(H):-house(H).
norwegian(H):-house(H).

solution(Hmilk,Htea,Hjuice,Hdog,Hfox,Hzebra,Hspaniard,Hukranian,Hnorwegian):-
        Hspaniard=Hdog,
        Hukranian=Htea,
        Hmilk=h3,
        next(Hnorwegian,Htea),
        Hjuice=Hfox,
        next(Hfox,Hdog),
        milk(Hmilk),          tea(Htea),             juice(Hjuice),
        dog(Hdog),            fox(Hfox),             zebra(Hzebra),
        spaniard(Hspaniard),  ukranian(Hukranian),   norwegian(Hnorwegian),
        Hdog\=Hfox,           Hdog\=Hzebra,          Hfox\=Hzebra,
        Hmilk\=Htea,          Hmilk\=Hjuice,         Htea\=Hjuice,
        Hspaniard\=Hukranian, Hspaniard\=Hnorwegian, Hukranian\=Hnorwegian.
