NR name output1
1  a    pan
1  b    before
2  a    eks
2  b    before
3  a    wye
3  b    before
4  a    eks
4  b    before
5  a    wye
5  b    before
6  a    zee
6  b    before
7  a    eks
7  b    before
8  a    zee
8  b    before
9  a    hat
9  b    before
10 a    pan
10 b    before

NR names output2
1  a_a   before
2  a_a   before
3  a_a   before
4  a_a   before
5  a_a   before
6  a_a   before
7  a_a   before
8  a_a   before
9  a_a   before
10 a_a   before
