How can I generate a table from wide to long with some specific conditions?

Then I wish to reshape the table, from wide to long, make only a variable named year, a index year, with previous year and 2 years prior to the index year but with one more condition. I would like to expand the year moving forward to year 2021 for each bene_id. Something like below.
This is what I am looking for..:

Can anyone give me some advice?
I use below codes but still got wrong table.. note: I generate the codes in Amazon Athena
WITH RECURSIVE YearSequence(bene_id, Year) AS (
SELECT bene_id, year
FROM tablea
UNION ALL
SELECT ts.bene_id, YearSequence.Year - 1
FROM YearSequence
JOIN tablea AS ts ON YearSequence.bene_id = ts.bene_id
WHERE YearSequence.Year > 2016
)
SELECT bene_id, Year
FROM YearSequence
WHERE Year <= 2021
ORDER BY bene_id, Year
);
No need to use recursive here,
sequence+unnestshould do the trick. Assuming thaty(y-2in you data) is always the "start" year something like the following:Output: