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

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

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

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

c = A("c")
b = B("b")
g = C("g")
a = D("a")
d = A("d")
e = C("e")
i = A("i")
h = C("h")
l = C("l")

c.x = a
c.w = a
c.s = a
c.z = b
b.q = d
g.w = i
a.x = b
a.u = g
a.t = l
d.x = a
d.w = a
d.s = a
d.z = b
e.w = d
i.x = a
i.w = a
i.s = a
i.z = b
h.w = d
l.w = d
assert i.x.t.w.z.txt == "
class A:
    def __init__(self, txt: str):
        self.x: D = None
        self.w: D = None
        self.z: B = None
        self.s: D = None
        self.txt = txt

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

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

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

c = A("c")
b = B("b")
g = C("g")
a = D("a")
d = A("d")
e = C("e")
i = A("i")
h = C("h")
l = C("l")

c.x = a
c.w = a
c.s = a
c.z = b
b.q = d
g.w = i
a.x = b
a.u = g
a.t = l
d.x = a
d.w = a
d.s = a
d.z = b
e.w = d
i.x = a
i.w = a
i.s = a
i.z = b
h.w = d
l.w = d
assert i.x.t.w.z.txt == "b"