to_string for list and deque