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

class B:
    def __init__(self, txt: str):
        self.q: C = None
        self.p: A = None
        self.x: D = None
        self.y: C = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.r: B = None
        self.y: C = None
        self.txt = txt

l = A("l")
g = B("g")
c = C("c")
e = D("e")
k = B("k")
d = B("d")
b = D("b")

l.z = g
l.t = b
l.o = b
l.s = e
g.q = c
g.y = c
g.p = l
g.x = b
c.z = b
c.w = b
c.y = l
e.r = d
e.y = c
k.q = c
k.y = c
k.p = l
k.x = e
d.q = c
d.y = c
d.p = l
d.x = e
b.r = k
b.y = c
assert b.r.x.y.w.y.y.o.txt == "
class A:
    def __init__(self, txt: str):
        self.z: B = None
        self.t: D = None
        self.o: D = None
        self.s: D = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.q: C = None
        self.p: A = None
        self.x: D = None
        self.y: C = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.r: B = None
        self.y: C = None
        self.txt = txt

l = A("l")
g = B("g")
c = C("c")
e = D("e")
k = B("k")
d = B("d")
b = D("b")

l.z = g
l.t = b
l.o = b
l.s = e
g.q = c
g.y = c
g.p = l
g.x = b
c.z = b
c.w = b
c.y = l
e.r = d
e.y = c
k.q = c
k.y = c
k.p = l
k.x = e
d.q = c
d.y = c
d.p = l
d.x = e
b.r = k
b.y = c
assert b.r.x.y.w.y.y.o.txt == "b"