# [APL (Dyalog Classic)], 27 bytes <!-- language-all: lang-apl --> {(⍺⊥⍺|(⍺⊤⍵)-⊢)¨1-1↓4⌽,⍳3 3} [Try it online!][TIO-jjrah20m] [APL (Dyalog Classic)]: https://www.dyalog.com/ [TIO-jjrah20m]: https://tio.run/##bY/PSgMxEMbvfYq57QZcTPZPV32bsO2Wxd2mJLmI9qJScNuIIB49WBV6lyIIXvoo8yLrZNuL0ASGIb9vvvkiZ3U0upK1mkRFLY2pig4fXyqFiyfelVSvQ3Q/2H5Svdm3H@i2LMJ2zXYbEQlcPKe4@j1B95VAMu86Q1Polrj63m2wvYXjB90rGKXtoCF5aLB9Z/jw5ps1O65WejTWkZxMlbFVAYVqZlJXRk0H1uekVA0Na7@9vStPKetFoC4DXN4HpazqwId3Wz3vzezY2EEYppCyjFngICCGFIZwBucg@AFxQiIDEYOgv5EmJ03Ww4yJAxyCyMkghozGc4ICEhZ7SG/eeG/OeyJ6T/7//gE "APL (Dyalog Classic) – Try It Online"