Thinking on the theory NBG (of von Neumann-Bernays--GödelNeumann–Bernays–Gödel) I arrived at the conclusion that it is contradictory using an argument resembling Russell's Paradox. I am sure that I made a mistake in my arguments (because NBG cannot be contradictory, as all mathematicians believe), but I can not find the exact place where the error happened.
The theory NBG is finitely axiomatizable theory whose undefined notions are "class" and "element". A class is called a set if it is an element of some other class. The axioms of NBG imply the existence of the universal class $\mathbf V$ containing all sets as elements. Axioms of NBG allow to make the following six basic operations over classes $X,Y$:
The difference: $X\setminus Y=\{z:z\in X\wedge z\notin Y\}$;
The Cartesian product: $X\times Y=\{\langle x,y\rangle:x\in X\wedge y\in Y\}$;
The transposition: $X^{-1}=\{\langle y,x\rangle:\langle x,y\rangle\in X\}$;
The cyclic permutation: $X^\circlearrowright=\{\langle\langle z,x\rangle,y\rangle:\langle\langle x,y\rangle,z\rangle\in X\}$;
The domain:$X$, $dom[X]=\{x:\exists y\;\langle x,y\rangle\in X\}$.$Y$:
The membership: $X_\in=\{\langle x,y\rangle\in X:x\in y\}$.
The difference: $X\setminus Y=\{z:z\in X\wedge z\notin Y\}$;
The Cartesian product: $X\times Y=\{\langle x,y\rangle:x\in X\wedge y\in Y\}$;
The transposition: $X^{-1}=\{\langle y,x\rangle:\langle x,y\rangle\in X\}$;
The cyclic permutation: $X^\circlearrowright=\{\langle\langle z,x\rangle,y\rangle:\langle\langle x,y\rangle,z\rangle\in X\}$;
The domain: $\DeclareMathOperator\dom{dom}\dom[X]=\{x:\exists y\;\langle x,y\rangle\in X\}$.
The membership: $X_\in=\{\langle x,y\rangle\in X:x\in y\}$.
All possible compositions of basic operations can be effectively enumerated by the set $T=\bigcup_{n\in\omega}7^{2^{<n}}$ of $7$7-labeled full binary trees of finite height.
The idea of this enumeration is as follows. First, enumerate the basic operations over classes $X,Y$:
$G_0(X,Y):=X$,
$G_1(X,Y):=X\setminus Y$,
$G_2(X,Y)=X\times Y$,
$G_3(X,Y):=X^{-1}$,
$G_4(X,Y)=X^\circlearrowright$,
$G_5(X,Y):=dom[X]$$X$, $Y$:
$G_6(X,Y)=X_\in.$\begin{align*} & G_0(X,Y):=X, \\ & G_1(X,Y):=X\setminus Y, \\ & G_2(X,Y)=X\times Y, \\ & G_3(X,Y):=X^{-1}, \\ & G_4(X,Y)=X^\circlearrowright \\ & G_5(X,Y):=\dom[X], \\ & G_6(X,Y)=X_\in. \end{align*}
For every $n\in\omega$, function $\lambda:2^{<n}\to 7=\{0,1,2,\dots,6\}$$\lambda:2^{<n}\to 7=\{0,1,2,\dotsc,6\}$, and class $X$, consider the class $G_\lambda(X)$ defined by the recursive formula $G_\lambda(X)=X$ if $n=0$ and $G_\lambda(X)=G_{\lambda(0)}(G_{\lambda\circ \vec 0}(X),G_{\lambda\circ \vec 1}(X))$ if $n>0$. So, $G_\lambda$ represents a composition of the basic operations taken in the order suggested by the labels at the vertices of the binary tree $2^{<n}$.
Assume for a moment that the Claim is proved. The constructibility of the class $C$ implies the constructibility of the class $\Lambda=\{\lambda\in T:\langle\lambda,\lambda\rangle\notin C\}$. Then thereethere exists a standard number $n\in\omega^\star\subseteq\omega$ and a 7-labeled tree $\lambda\in 7^{2^{<n}}$ such that $\Lambda=C_\lambda:=\{x\in\mathbf V:\langle\lambda,x\rangle\in C\}$. Now we have a paradox of Russell's type:
if $\lambda\in\Lambda$, then $\lambda\in C_\lambda$ and hence $\langle\lambda,\lambda\rangle\in C$ and $\lambda\notin\Lambda$;
if $\lambda\notin\Lambda$, then $\langle\lambda,\lambda\rangle\in C$ and hence $\lambda\in C_\lambda=\Lambda$.
if $\lambda\in\Lambda$, then $\lambda\in C_\lambda$ and hence $\langle\lambda,\lambda\rangle\in C$ and $\lambda\notin\Lambda$;
if $\lambda\notin\Lambda$, then $\langle\lambda,\lambda\rangle\in C$ and hence $\lambda\in C_\lambda=\Lambda$.
Applying the Theorem of Recursion, for every ordinals $\alpha,\beta$ one can construct a class $C_{\alpha,\beta}\subseteq T\times\mathbf V$ such that for every standard number $n\in\omega^\star\subseteq\omega$ and 7-labeled tree $\lambda\in 7^{2^{<n}}$ we have $\{x\in \mathbf V:\langle \lambda,x\rangle\in C_{\alpha,\beta}\}=V_\alpha\cap C_\lambda(V_\beta)\}$. Moreover, the recursive definition of the indexed sequence $(C_{\alpha,\beta})_{\alpha,\beta\in\mathbf{On}}$ shows that it is constructible as a subclass of $\mathbf{On}\times\mathbf{On}\times T\times\mathbf V$ (because it is defined by a formula whose quantifiers run over elements of the universal set). For every ordinal $\alpha$ consider the class $$C_\alpha=\{\langle\lambda,x\rangle\in T\times\mathbf V:\exists \beta\in\mathbf{On}\;\forall \gamma\in \mathbf{On}\; (\beta\le \gamma\to \langle \lambda,x\rangle \in C_{\alpha,\gamma})\}.$$The The constructibility of the family $(C_{\alpha,\beta})_{\alpha,\beta\in \mathbf{On}}$ implies the constructibility of the set indexed family $(C_\alpha)_{\alpha\in\mathbf {On}}$ (identified with the subclass $\bigcup_{\alpha\in\mathbf{On}}\{\alpha\}\times C_\alpha$ of the class $\mathbf{On}\times (T\times\mathbf V)$. The constructibility of the indexed family $(C_\alpha)_{\alpha\in\mathbf{On}}$ implies the constructibility of the class $$C=\{\langle \lambda,x\rangle\in T\times\mathbf V:\exists \alpha\in\mathbf{On}\;\langle\lambda,x\rangle\in C_\alpha\},$$which which has the property, required in the Claim. $\square$
Question. In which place does this argument proving the inconsistency of NBG does contain a gap?