using two hash tables