flatten&unflatten linked list