Write SQL and HIVE query to print the year in which the 2nd highest salary was paid for each country?.

Please provide query for the below table

```
country,salary,year
india,1000,2017
japan,2000,2017
germany,1500,2017
india,1250,2018
japan,500,2018
china,955,2017
japan,850,2019
china,1150,2018
india,1250,2019

```