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

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

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

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

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

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

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

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

n.q = h
n.z = f
f.q = h
f.o = e
f.r = n
m.q = j
e.q = h
e.o = l
e.r = n
j.q = m
h.q = e
h.o = e
h.r = n
l.q = f
l.o = h
l.r = n
assert e.o.o.q.q.r.q.q.txt == "e"