compare qgram during merging