function [im1,im2] = query(img, db)

for i=1:8
    sim(i) = histogramSimilarity(img, db{i});
end
[sim_asc,idx] = sort(sim);
im1 = db{idx(1)};
im2 = db{idx(2)};
