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

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

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

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

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

l.z = a
c.t = f
h.p = e
h.w = e
h.y = b
a.r = b
a.z = c
f.r = b
f.z = c
b.p = h
b.y = h
b.w = h
g.t = f
e.p = h
e.y = h
e.w = h
assert h.p.y.w.w.y.w.y.txt == "
class A:
    def __init__(self, txt: str):
        self.z: D = None
        self.txt = txt

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

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

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

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

l.z = a
c.t = f
h.p = e
h.w = e
h.y = b
a.r = b
a.z = c
f.r = b
f.z = c
b.p = h
b.y = h
b.w = h
g.t = f
e.p = h
e.y = h
e.w = h
assert h.p.y.w.w.y.w.y.txt == "b"