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

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

class C:
    def __init__(self, txt: str):
        self.p: A = None
        self.r: D = None
        self.u: D = None
        self.txt = txt

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

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

i.w = d
c.t = a
c.v = f
c.r = d
h.p = f
h.r = d
h.u = d
d.z = a
d.q = f
d.u = h
d.o = h
a.t = c
a.v = f
a.r = d
e.z = c
e.q = l
e.u = h
e.o = h
l.w = d
f.w = d
g.w = e
assert c.v.w.z.r.u.txt == "
class A:
    def __init__(self, txt: str):
        self.w: D = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.p: A = None
        self.r: D = None
        self.u: D = None
        self.txt = txt

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

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

i.w = d
c.t = a
c.v = f
c.r = d
h.p = f
h.r = d
h.u = d
d.z = a
d.q = f
d.u = h
d.o = h
a.t = c
a.v = f
a.r = d
e.z = c
e.q = l
e.u = h
e.o = h
l.w = d
f.w = d
g.w = e
assert c.v.w.z.r.u.txt == "h"