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

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

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

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

b = A("b")
a = B("a")
f = C("f")
e = D("e")
n = A("n")
j = B("j")
m = A("m")
g = D("g")
d = B("d")
i = C("i")

b.u = f
a.v = n
a.u = n
a.t = f
a.r = g
f.y = i
f.q = d
f.z = e
e.s = f
e.z = f
e.t = g
n.u = f
j.v = n
j.u = n
j.t = i
j.r = e
m.u = i
g.s = i
g.z = i
g.t = e
d.v = m
d.t = i
d.r = e
d.u = n
i.y = f
i.q = d
i.z = e
assert d.t.y.z.txt == "
class A:
    def __init__(self, txt: str):
        self.u: C = None
        self.txt = txt

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

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

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

b = A("b")
a = B("a")
f = C("f")
e = D("e")
n = A("n")
j = B("j")
m = A("m")
g = D("g")
d = B("d")
i = C("i")

b.u = f
a.v = n
a.u = n
a.t = f
a.r = g
f.y = i
f.q = d
f.z = e
e.s = f
e.z = f
e.t = g
n.u = f
j.v = n
j.u = n
j.t = i
j.r = e
m.u = i
g.s = i
g.z = i
g.t = e
d.v = m
d.t = i
d.r = e
d.u = n
i.y = f
i.q = d
i.z = e
assert d.t.y.z.txt == "e"