\documentclass{article}
\usepackage{a4wide}
\usepackage{adjustbox}
\usepackage{fancyhdr}
\usepackage{tikz}
\usepackage{ifthen}
\usetikzlibrary{automata}
\usepackage{datetime}
\lhead{./certificates/patternthenloop1-patternthenloop2/sim-40622.tex}
\rhead{09:11:48.814 on 2025-04-03}
\fancyfoot{}
\begin{document}
\newif\ifntiny
%\ntinyfalse
\ntinytrue
\thispagestyle{fancy}
\begin{center}
\maxsizebox{!}{0.475\textheight}{
\minsizebox{\textwidth}{!}{
\begin{tabular}{@{}c@{}}
% node count = 21
\begin{tikzpicture}[rotate = 0]
%\begin{tikzpicture}[rotate = 90]
\tikzset{initial text=$ $}

\node[accepting, state] at (12,-4) (n2n0) {$p?$\,\ifntiny{\tiny 41510}\fi};
\node[accepting, state] at (9,-4) (n1n0) {$p!$\,\ifntiny{\tiny 41492}\fi};
\node[accepting, state] at (8,-6) (n0n1n1) {$p?$\,\ifntiny{\tiny 41500}\fi};
\node[state] at (7,-4) (n0n1) {$\cup$\,\ifntiny{\tiny 41550}\fi};
\node[state] at (2,-8) (n0n0n0n1) {$\cup$\,\ifntiny{\tiny 41556}\fi};
\node[state] at (4,-2) (n0) {$p?$\,\ifntiny{\tiny 41559}\fi};
\node[accepting, state] at (11,-6) (n2n0n0) {$p!$\,\ifntiny{\tiny 41506}\fi};
\node[accepting, state] at (12,-2) (n2) {$p!$\,\ifntiny{\tiny 41509}\fi};
\node[accepting, state] at (10,-2) (n1) {$p?$\,\ifntiny{\tiny 41500}\fi};
\node[accepting, state] at (3,-12) (n0n0n0n1n1n1) {$p!$\,\ifntiny{\tiny 41499}\fi};
\node[accepting, state] at (4,-8) (n0n0n1n0) {$p!$\,\ifntiny{\tiny 41355}\fi};
\node[accepting, state] at (5,-8) (n0n0n1n1) {$p!$\,\ifntiny{\tiny 41366}\fi};
\node[accepting, state] at (2,-12) (n0n0n0n1n1n0) {$p!$\,\ifntiny{\tiny 41492}\fi};
\node[initial, state] at (6,0) (n) {$\cup$\,\ifntiny{\tiny 41560}\fi};
\node[state] at (2,-6) (n0n0n0) {$p?$\,\ifntiny{\tiny 41557}\fi};
\node[state] at (3,-4) (n0n0) {$\cup$\,\ifntiny{\tiny 41558}\fi};
\node[accepting, state] at (7,-8) (n0n1n1n0) {$p!$\,\ifntiny{\tiny 41492}\fi};
\node[accepting, state] at (3,-10) (n0n0n0n1n1) {$p?$\,\ifntiny{\tiny 41500}\fi};
\node[accepting, state] at (8,-8) (n0n1n1n1) {$p!$\,\ifntiny{\tiny 41499}\fi};
\node[accepting, state] at (5,-6) (n0n0n1) {$p?$\,\ifntiny{\tiny 41367}\fi};
\node[accepting, state] at (10,-4) (n1n1) {$p!$\,\ifntiny{\tiny 41499}\fi};

\draw[->, thick] (n) edge [near start, left] node {} (n0);
\draw[->, thick] (n) edge [near start, left] node {} (n1);
\draw[->, thick] (n) edge [near start, left] node {} (n2);
\draw[->, thick] (n0) edge [near start, left] node {d} (n0n0);
\draw[->, thick] (n0) edge [near start, left] node {x} (n0n1);
\draw[->, thick] (n0n0) edge [near start, left] node {} (n0n0n0);
\draw[->, thick] (n0n0) edge [near start, left] node {} (n0n0n1);
\draw[->, thick] (n0n0n0) edge [near start, right, bend right] node {d} (n0n0);
\draw[->, thick] (n0n0n0) edge [near start, left] node {x} (n0n0n0n1);
\draw[->, thick] (n0n0n0n1) edge [near start, right, bend right] node {} (n0);
\draw[->, thick] (n0n0n0n1) edge [near start, left] node {} (n0n0n0n1n1);
\draw[->, thick] (n0n0n0n1n1) edge [near start, left] node {d} (n0n0n0n1n1n0);
\draw[->, thick] (n0n0n0n1n1) edge [near start, left] node {x} (n0n0n0n1n1n1);
\draw[->, thick] (n0n0n0n1n1n0) edge [near start, right, bend right] node {a} (n0n0n0n1n1);
\draw[->, thick] (n0n0n0n1n1n1) edge [near start, right, bend right] node {a} (n0n0n0n1n1);
\draw[->, thick] (n0n0n1) edge [near start, left] node {d} (n0n0n1n0);
\draw[->, thick] (n0n0n1) edge [near start, left] node {x} (n0n0n1n1);
\draw[->, thick] (n0n0n1n0) edge [near start, right, bend right] node {a} (n0n0n1);
\draw[->, thick] (n0n0n1n1) edge [near start, right, bend right] node {a} (n0n0n1);
\draw[->, thick] (n0n1) edge [near start, left, bend left] node {} (n0);
\draw[->, thick] (n0n1) edge [near start, left] node {} (n0n1n1);
\draw[->, thick] (n0n1n1) edge [near start, left] node {d} (n0n1n1n0);
\draw[->, thick] (n0n1n1) edge [near start, left] node {x} (n0n1n1n1);
\draw[->, thick] (n0n1n1n0) edge [near start, right, bend right] node {a} (n0n1n1);
\draw[->, thick] (n0n1n1n1) edge [near start, right, bend right] node {a} (n0n1n1);
\draw[->, thick] (n1) edge [near start, left] node {d} (n1n0);
\draw[->, thick] (n1) edge [near start, left] node {x} (n1n1);
\draw[->, thick] (n1n0) edge [near start, right, bend right] node {a} (n1);
\draw[->, thick] (n1n1) edge [near start, right, bend right] node {a} (n1);
\draw[->, thick] (n2) edge [near start, left] node {a} (n2n0);
\draw[->, thick] (n2n0) edge [near start, left] node {d} (n2n0n0);
\draw[->, thick] (n2n0) edge [near start, right, bend right] node {x} (n2);
\draw[->, thick] (n2n0n0) edge [near start, right, bend right] node {a} (n2n0);

\end{tikzpicture}
\end{tabular}}}
\end{center}
\end{document}
