Skip to main content
1 of 2
Kevin Cruijssen
  • 131.4k
  • 13
  • 144
  • 384

05AB1E, 37 bytes

56YLÌ'fìâ„g4δšDí«ε`"1.ÿ eÿ 2.ÿ Qh4#",

Try it online.

If outputting as a list of lines is allowed, the trailing ", can be removed for -2 bytes: try it online.

Explanation:

56             # Push 56
  YL           # Push pair [1,2]
    Ì          # Increase each by 2: [3,4]
     'fì      '# Prepend an "f" to each: ["f3","f4"]
        â      # Get the cartesian product of these two:
               #  [[5,"f3"],[5,"f4"],[6,"f3"],[6,"f4"]]
           δ   # Map over each inner list:
         „g4 š #  Prepend string "g4" to the list
               #   [["g4",5,"f3"],["g4",5,"f4"],["g4",6,"f3"],["g4",6,"f4"]]
D              # Duplicate this list of lists
 í             # Reverse each inner list:
               #  [["f3",5,"g4"],["f4",5,"g4"],["f3",6,"g4"],["f4",6,"g4"]]
  «            # Merge the two lists together
ε              # Foreach over each inner list:
 `             #  Pop and push the items of the list (in reversed order) to the stack
  "1.ÿ eÿ 2.ÿ Qh4#"
               #  Push this string, with the `ÿ` automatically filled with the items
    ,          #  Pop and print it with trailing newline
Kevin Cruijssen
  • 131.4k
  • 13
  • 144
  • 384