Please solve the programming task below using a self-contained code snippet in a markdown code block.

Given a string n representing an integer, return the closest integer (not including itself), which is a palindrome. If there is a tie, return the smaller one.
The closest is defined as the absolute difference minimized between two integers.
 
Please complete the following python code precisely:
```python
class Solution:
    def nearestPalindromic(self, n: str) -> str:
```