And... Yet Another AND Problem

YouKn0wWho has an integer nnn. He wants to find an integer sequence aaa of size exactly 2n2n2n such that 0≤ai<2n0 \le a_i \lt 2^n0≤ai​<2n for each valid iii and for each integer kkk from 000 to 2n−12^n - 12n−1, there exists at least one non-empty subsequence of aaa such that the bitwise AND of the elements of that subsequence is kkk.


This is a companion discussion topic for the original entry at https://toph.co/p/and-yet-another-and-problem