'Removes a value from the collection. Returns true if the collection contained the specified element.
:type val: int
:rtype: bool'

def remove(self, val):

    if (val not in self.__used):
        return False
    self.__used[self.__list[(-1)]][(-1)] = self.__used[val][(-1)]
    (self.__list[self.__used[val][(-1)]], self.__list[(-1)]) = (self.__list[(-1)], self.__list[self.__used[val][(-1)]])
    self.__used[val].pop()
    if (not self.__used[val]):
        self.__used.pop(val)
    self.__list.pop()
    return True
