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

class B:
    def __init__(self, txt: str):
        self.z: A = None
        self.w: A = None
        self.t: C = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.r: C = None
        self.o: C = None
        self.txt = txt

n = A("n")
l = B("l")
e = C("e")
f = B("f")
b = B("b")
j = C("j")

n.q = l
l.z = n
l.w = n
l.t = e
e.r = j
e.o = j
f.z = n
f.w = n
f.t = j
b.z = n
b.w = n
b.t = j
j.r = e
j.o = e
assert j.o.r.r.r.txt == "
class A:
    def __init__(self, txt: str):
        self.q: B = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.z: A = None
        self.w: A = None
        self.t: C = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.r: C = None
        self.o: C = None
        self.txt = txt

n = A("n")
l = B("l")
e = C("e")
f = B("f")
b = B("b")
j = C("j")

n.q = l
l.z = n
l.w = n
l.t = e
e.r = j
e.o = j
f.z = n
f.w = n
f.t = j
b.z = n
b.w = n
b.t = j
j.r = e
j.o = e
assert j.o.r.r.r.txt == "j"