Separate lists and tuples so that it is possible to do in queries