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

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

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

a = A("a")
g = B("g")
d = C("d")
c = C("c")
f = B("f")
e = A("e")
l = A("l")
j = B("j")
b = A("b")

a.z = g
a.o = c
a.w = c
g.o = d
d.x = c
d.z = l
d.q = l
c.x = d
c.z = e
c.q = l
f.o = d
e.z = g
e.o = d
e.w = c
l.z = f
l.o = c
l.w = d
j.o = c
b.z = f
b.o = d
b.w = c
assert l.z.o.x.z.o.x.q.w.txt == "
class A:
    def __init__(self, txt: str):
        self.z: B = None
        self.o: C = None
        self.w: C = None
        self.txt = txt

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

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

a = A("a")
g = B("g")
d = C("d")
c = C("c")
f = B("f")
e = A("e")
l = A("l")
j = B("j")
b = A("b")

a.z = g
a.o = c
a.w = c
g.o = d
d.x = c
d.z = l
d.q = l
c.x = d
c.z = e
c.q = l
f.o = d
e.z = g
e.o = d
e.w = c
l.z = f
l.o = c
l.w = d
j.o = c
b.z = f
b.o = d
b.w = c
assert l.z.o.x.z.o.x.q.w.txt == "d"