Smarts string for querying two N substitutions at any place along bicyclic ring

I'm a newbie to SMARTs string representation and have been stuck on generating the structure that I want. I have a pattern of chemical scaffold of interest which I'd use as a query to screen a library. The pattern is a bicyclic ring (with a functional group attached) with single N substitution at every valid and possible location (the first row of attached fig) AND a bicyclic ring with two N substitutions at every valid/possible location. (the second row of attached fig)


[![enter image description here](https://i.stack.imgur.com/Fr683m.png)](https://i.stack.imgur.com/Fr683m.png)


I've been searching through the bottom of the Internet and couldn't figure out how to write this in SMARTS string. (since Smarts is a query language, I figured I'd do there first.


Alternative, is to generate SMILES string and run the substructure search independently. However, I haven't figure out a way to generate SMILES without me having to manually writing them down. If you have any pointers - please let me know!


