reimplement Stack & Queue using generic type