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

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

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

a = A("a")
d = B("d")
n = C("n")
b = A("b")
j = C("j")
i = B("i")
c = B("c")
m = A("m")

a.z = d
d.o = c
d.q = c
d.x = c
n.x = d
n.s = c
b.z = c
j.x = c
j.s = c
i.o = c
i.q = d
i.x = d
c.o = d
c.q = d
c.x = d
m.z = d
assert j.s.o.q.txt == "
class A:
    def __init__(self, txt: str):
        self.z: B = None
        self.txt = txt

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

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

a = A("a")
d = B("d")
n = C("n")
b = A("b")
j = C("j")
i = B("i")
c = B("c")
m = A("m")

a.z = d
d.o = c
d.q = c
d.x = c
n.x = d
n.s = c
b.z = c
j.x = c
j.s = c
i.o = c
i.q = d
i.x = d
c.o = d
c.q = d
c.x = d
m.z = d
assert j.s.o.q.txt == "c"