Visualize a Nim board like an expert Background
In the game of Nim, players alternate removing &quot;stones&quot; from &quot;piles&quot;: on each turn, a player must remove between one and all stones from a single pile.  The object of Nim is to take the last stone or, in the misere variant, to force your opponent to do so -- however, it turns out the strategies are nearly identical.
Nim makes a fun bar game. You can use matchsticks or coins for the &quot;stones,&quot; and the &quot;piles&quot; are typically arranged in a line.  Below is a classic setup with piles of 1, 3, 5, and 7:

If you've never played Nim before, you might try your hand at it before attempting this challenge.  Here's a version called &quot;Pearls Before Swine&quot;.
Strategy
Optimal strategy in Nim is tricky enough that most lay people lose consistently to an expert, but simple to describe with binary arithmetic.
Doing mental binary XOR operations, however, is tough, so luckily there is an  equivalent way to visualize the correct strategy which is easier to implement in real time, even when drunk.
There are only three steps:

Mentally group the &quot;stones&quot; in each line into subgroups whose sizes are powers of 2, starting with the largest possible size: 8, 4, 2, and 1 are sufficient for most games.
Try to match each group with a twin in another line, so that every group has a pair.
If this isn't possible, remove unpaired &quot;stones&quot; from a single line (this will always be possible - see the Wikipedia link for why) so that step 2. becomes possible.

Or, said another way: &quot;Remove some stone(s) from a single pile such that if you then group the piles into powers of 2 all groups may be paired with a group in some other pile.&quot;  With the caveat that you cannot break up larger powers of 2 into smaller ones -- eg, you cannot group a line with 8 stones into two groups of 4.
For example here's how you'd visualize the board above:

This board is perfectly balanced, so you'd want your opponent to move first.
The Challenge
Given a list of positive integers representing the size of Nim &quot;piles&quot;, return a plain text visualization of the Nim board as seen by an expert.
What constitutes a valid visualization is best explained by example, but you must:

Assign a distinct character to each &quot;power-of-2 subgroup&quot; and its pair (unpaired subgroups do not qualify), and use that character to represent the &quot;stones&quot; in both subgroup and pair.
Represent any unpaired &quot;stones&quot; (ie, the ones an expert would remove when playing normal -- not misere -- Nim) using a hyphen: -.

There will be multiple ways to achieve a valid visualization, and all are valid.  Let's work through some test cases:
Test Cases
Input: 1, 3, 5, 7
Possible Output 1:
A
BBA
CCCCD
CCCCBBD

You may optionally include spaces between the characters, as well as blank lines between the rows:
Possible Output 2:
A

B B A

C C C C D

C C C C B B D

Input: 1, 2, 3, 4, 5, 6, 7, 8, 9, 10
The order and choice of characters can be whatever you like:
Possible Output 1:
G
E E
E E G
C C C C
C C C C F
B B B B D D
B B B B D D F
H H I - - - - -
A A A A A A A A I
A A A A A A A A H H

Unicode symbols are ok too:
Possible Output 2:
◎
◈  ◈
◈  ◈  ◎
△  △  △  △
△  △  △  △  ◉
◐  ◐  ◐  ◐  ◀  ◀
◐  ◐  ◐  ◐  ◀  ◀  ◉
▽  ▽  ◒  -  -  -  -  -
▥  ▥  ▥  ▥  ▥  ▥  ▥  ▥  ◒ 
▥  ▥  ▥  ▥  ▥  ▥  ▥  ▥  ▽  ▽  

Input: 7
From the rules it follows that any &quot;single pile&quot; must be completely removed.
Possible Output 1:
-------

Possible Output 2:
- - - - - - -

Input: 5, 5
Possible Output:
A A A A B
A A A A B

Additional Rules

This is code golf with standard rules.  Shortest code wins.
Input is flexible, and may be taken in whatever list-ish form is convenient to you.
Output is flexible too, as the above examples illustrate.  Most reasonable variations will be allowed.  Ask if you're unsure about something.
Python 2, 150 196 206 bytes



def f(p):
 c=48;s=[l*'.'for l in p];m=2**len(bin(l))
 while m:
  if sum(m*'.'in l for l in s)&gt;1:
   for i,l in enumerate(s):s[i]=l.replace('.'*m,chr(c)*m,`s`.count(chr(c)*m)&lt;2)
   c+=1
  else:m/=2
 return s


Try it online!