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

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

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

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

d = A("d")
j = B("j")
c = C("c")
k = D("k")
g = D("g")
f = B("f")
h = C("h")
e = B("e")
i = B("i")
b = B("b")

d.u = g
d.t = h
j.r = e
c.s = g
c.z = k
k.z = h
k.w = h
k.v = d
g.z = h
g.v = d
g.w = c
f.r = b
h.s = g
h.z = g
e.r = i
i.r = j
b.r = j
assert b.r.r.r.r.r.r.txt == "
class A:
    def __init__(self, txt: str):
        self.u: D = None
        self.t: C = None
        self.txt = txt

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

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

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

d = A("d")
j = B("j")
c = C("c")
k = D("k")
g = D("g")
f = B("f")
h = C("h")
e = B("e")
i = B("i")
b = B("b")

d.u = g
d.t = h
j.r = e
c.s = g
c.z = k
k.z = h
k.w = h
k.v = d
g.z = h
g.v = d
g.w = c
f.r = b
h.s = g
h.z = g
e.r = i
i.r = j
b.r = j
assert b.r.r.r.r.r.r.txt == "i"