Traditionally, the Chinese have counted years using two simultaneous cycles, one of length 10 (the "celestial stems") and one of length 12 (the "terrestrial branches"); the combination results in a repeating 60-year pattern. Mapping the branches to twelve traditional animal deities results in the well-known "Chinese zodiac", assigning each year to a given animal. For example, Tuesday, February 1, 2022 CE (in the common Gregorian calendar) will begin the lunisolar Year of the Tiger.

The celestial stems have no one-to-one mapping like that of the branches to animals; however, the five pairs of consecutive stems each belong to one of the five traditional Chinese elements (Wood, Fire, Earth, Metal, and Water). Further, one of the two years within each element's governance is associated with yin, the other with yang.

Thus, 2022 is also the yang year of Water. Note that since 12 is an even number, the association between animals and yin/yang doesn't change. Consecutive Years of the Rooster will cycle through the five elements, but will always be yin, despite the apparent conceptual mismatch between the specifically-male English animal name and the female aspect denoted by yin.

Task
 Create a subroutine or program that will return or output the animal, yin/yang association, and element for the lunisolar year that begins in a given CE year.
You may optionally provide more information in the form of the year's numerical position within the 60-year cycle and/or its actual Chinese stem-branch name (in Han characters or Pinyin transliteration).

Requisite information

 The animal cycle runs in this order: Rat, Ox, Tiger, Rabbit, Dragon, Snake, Horse, Goat, Monkey, Rooster, Dog, Pig.
 The element cycle runs in this order: Wood, Fire, Earth, Metal, Water.
 The yang year precedes the yin year within each element.
 The current 60-year cycle began in 1984 CE; the first cycle of the Common Era began in 4 CE.
Thus, 1984 was the year of the Wood Rat (yang), 1985 was the year of the Wood Ox (yin), and 1986 the year of the Fire Tiger (yang); 2022 - which, as already noted, is the year of the Water Tiger (yang) - is the 39th year of the current cycle.

Information for optional task

 The ten celestial stems are 甲 jiă, 乙 yĭ, 丙 bĭng, 丁 dīng, 戊 wù, 己 jĭ, 庚 gēng, 辛 xīn, 壬 rén, and 癸 gŭi. With the ASCII version of Pinyin tones, the names are written "jia3", "yi3", "bing3", "ding1", "wu4", "ji3", "geng1", "xin1", "ren2", and "gui3".
 The twelve terrestrial branches are 子 zĭ, 丑 chŏu, 寅 yín, 卯 măo, 辰 chén, 巳 sì, 午 wŭ, 未 wèi, 申 shēn, 酉 yŏu, 戌 xū, 亥 hài. In ASCII Pinyin, those are "zi3", "chou3", "yin2", "mao3", "chen2", "si4", "wu3", "wei4", "shen1", "you3", "xu1", and "hai4".
Therefore 1984 was 甲子 (jiă-zĭ, or jia3-zi3). 2022 is 壬寅 (rén-yín or ren2-yin2).

1000 rem display the chinese zodiac for a given year
1010 poke 53281,7: rem yellow background
1020 poke 53280,2: rem red border
1030 poke 646,2: rem red text
1040 h1$="chinese zodiac":gosub 2000 set-heading
1050 gosub 3000 initialize-data
1060 print
1070 print "enter year (return to quit):";
1080 get k$:if k$="" then 1080
1090 if k$=chr$(13) then end
1100 poke 631,asc(k$):poke 198,1:rem ungetc(k$)
1110 open 1,0: input#1, y$: close 1:print
1120 if val(y$)=0 and y$<>"0" then print chr$(145):goto 1060
1130 y=val(y$)-4
1140 sy=fnym(60): rem year of the sexagesimal cycle
1150 cs=fnym(10): rem celestial stem
1160 tb=fnym(12): rem terrestrial branch
1170 el=int(cs/2): rem element
1180 za=tb: rem zodiac animal
1190 as=fnym(2): rem aspect
1200 print
1210 print "the chinese year beginning in ce "y$
1220 print "is "cs$(cs)"-"tb$(tb)", year"(sy+1)"of 60,"
1230 print "the year of the "el$(el)" "za$(za)" ("as$(as)")."
1260 goto 1060
1270 end
2000 print chr$(147);chr$(18);"****";
2010 sp=32-len(h1$)
2020 for i=1 to int(sp/2)
2030 : print " ";
2040 next i
2050 print h1$;
2060 for i=i to sp
2070 : print " ";
2080 next i
2090 print "****";
2100 return
3000 dim cs$(9): rem ten celestial stems
3010 dim tb$(11): rem twelve terrestrial branches
3020 dim za$(11): rem twelve "zodiac" animals
3030 dim el$(4): rem five elements
3040 dim as$(1): rem two aspects
3050 for i=0 to 9
3060 : read cs$(i)
3070 next i
3080 data jia3, yi3, bing3, ding1, wu4
3090 data ji3, geng1, xin1, ren2, gui3
3100 for i=0 to 11
3110 : read tb$(i)
3120 next i
3130 data zi3, chou3, yin2, mao3
3140 data chen2, si4, wu3, wei4
3150 data shen2, you3, xu1, hai4
3160 for i=0 to 11
3170 : read za$(i)
3180 next i
3190 data rat, ox, tiger, rabbit
3200 data dragon, snake, horse, goat
3210 data monkey, rooster, dog, pig
3220 for i=0 to 4
3230 : read el$(i)
3240 next i
3250 data wood, fire, earth
3260 data metal, water
3270 for i=0 to 1
3280 : read as$(i)
3290 next i
3300 data yang, yin
3310 rem year-mod function
3320 def fnym(d) = y - int(y/d)*d
3330 return