product(item1,3000,4.8,20).
product(item2,1800,4.2,200).
product(item3,5000,4.9,5).
product(item4,2500,4.5,80).

high_rating(Item) :-
    product(Item, _, Rating, _),
    Rating >= 4.5.

affordable(Item) :-
    product(Item, Price, _, _),
    Price =< 3000.

popular(Item) :-
    product(Item, _, _, Reviews),
    Reviews >= 50.

recommended(Item) :-
    high_rating(Item),
    affordable(Item),
    popular(Item).