\def\iftwo#1#2#3#4#5\elsefirst#6\elsesecond#7\elseneither#8\owtfi
{\if#1#2\if#3#4#5\else#6\fi\else\if#3#4#7\else#8\fi\fi}

\def\both{***both***}
\def\first{***first***}
\def\second{***second***}
\def\neither{***neither***}
\message{\iftwo{1}{1}{2}{2}\both\elsefirst\first\elsesecond\second\elseneither\neither\owtfi}
\message{\iftwo{1}{1}{2}{-2}\both\elsefirst\first\elsesecond\second\elseneither\neither\owtfi}
\message{\iftwo{1}{-1}{2}{2}\both\elsefirst\first\elsesecond\second\elseneither\neither\owtfi}
\message{\iftwo{1}{-1}{2}{-2}\both\elsefirst\first\elsesecond\second\elseneither\neither\owtfi}

\bye
