# Symbol to denote a group which is either an oxygen atom or NH group

I'm drawing the generic structure of several different organic molecules in my thesis. They share some features, one of which is a carbonyl carbon attached to either an oxygen atom (i.e. ester) or an $$\ce{-NH}$$ (i.e. amide).

My first instinct was to draw it like this: $$\ce{R-X-C(=O)-R'}$$

But I wonder if X wrongly implies that it's a halogen? In which case, what would be the correct letter or symbol to use? I've seen Z used sometimes when X is used elsewhere, would that be more appropriate? Or perhaps Q for heteroatom, as in Reaxys? Or A for 'any'?

I'm actually drawing in ChemDraw, this is simplified for the sake of the question

Edit: corrected mistake (nitrogen atom -> $$\ce{-NH}$$ group)

Oxygen and nitrogen have different valencies, so you can't use the same letter to denote literally an $$\ce{O}$$ or an $$\ce{N}$$ atom, as they can't be directly substituted for one another.
You should use the same letter to denote $$\ce{O}$$ or $$\ce{NH}$$, for example. It's perfectly permissible to write $$\ce{R-X-C(O)-R'}$$ and say $$\ce{X} = \ce{O}, \ce{NH}$$. This approach is commonly used in the literature. If your amide is tertiary then write something like $$\ce{X} = \ce{O}, \ce{NH}, \ce{NR}$$. The same applies to structures drawn in ChemDraw.
Beyond that, the choice of letter is arbitrary (as long as you define it!) so $$\ce{X}$$ is perfectly fine, although you should obviously avoid letters which already represent a chemical element (e.g. $$\ce{B}$$, $$\ce{C}$$, ...).