Made a function that prints n elements of stacktrace