class A:
    def __init__(self, txt: str):
        self.o: B = None
        self.u: C = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.r: B = None
        self.q: B = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.s: A = None
        self.txt = txt

e = A("e")
n = B("n")
k = C("k")
b = C("b")
a = B("a")

e.o = a
e.u = k
n.r = a
n.q = a
k.s = e
b.s = e
a.r = n
a.q = n
assert e.o.q.q.txt == "
class A:
    def __init__(self, txt: str):
        self.o: B = None
        self.u: C = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.r: B = None
        self.q: B = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.s: A = None
        self.txt = txt

e = A("e")
n = B("n")
k = C("k")
b = C("b")
a = B("a")

e.o = a
e.u = k
n.r = a
n.q = a
k.s = e
b.s = e
a.r = n
a.q = n
assert e.o.q.q.txt == "a"