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

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

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

j = A("j")
e = B("e")
l = C("l")
c = A("c")
n = A("n")
m = C("m")
f = B("f")
b = B("b")
i = C("i")
k = C("k")

j.q = k
j.o = f
e.z = f
e.s = c
l.s = c
l.o = j
c.q = m
c.o = b
n.q = k
n.o = b
m.s = n
m.o = c
f.z = b
f.s = n
b.z = f
b.s = n
i.s = n
i.o = c
k.s = n
k.o = j
assert e.z.s.o.z.txt == "
class A:
    def __init__(self, txt: str):
        self.q: C = None
        self.o: B = None
        self.txt = txt

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

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

j = A("j")
e = B("e")
l = C("l")
c = A("c")
n = A("n")
m = C("m")
f = B("f")
b = B("b")
i = C("i")
k = C("k")

j.q = k
j.o = f
e.z = f
e.s = c
l.s = c
l.o = j
c.q = m
c.o = b
n.q = k
n.o = b
m.s = n
m.o = c
f.z = b
f.s = n
b.z = f
b.s = n
i.s = n
i.o = c
k.s = n
k.o = j
assert e.z.s.o.z.txt == "f"