Issue in the code

testcases are not passing ???

your code and approach both are correct
but in output you also have to print one tab and space before every line
so after that your code is passed you can see it below

Modified Code