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

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

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

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

a = A("a")
j = B("j")
i = C("i")
b = D("b")
d = C("d")
k = C("k")
m = A("m")
e = C("e")

a.t = k
j.u = a
i.r = b
i.z = e
i.x = m
i.v = a
b.w = j
b.p = j
d.r = b
d.z = k
d.x = m
d.v = a
k.r = b
k.z = d
k.x = a
k.v = a
m.t = d
e.r = b
e.z = i
e.x = m
e.v = a
assert i.r.w.u.t.x.txt == "
class A:
    def __init__(self, txt: str):
        self.t: C = None
        self.txt = txt

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

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

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

a = A("a")
j = B("j")
i = C("i")
b = D("b")
d = C("d")
k = C("k")
m = A("m")
e = C("e")

a.t = k
j.u = a
i.r = b
i.z = e
i.x = m
i.v = a
b.w = j
b.p = j
d.r = b
d.z = k
d.x = m
d.v = a
k.r = b
k.z = d
k.x = a
k.v = a
m.t = d
e.r = b
e.z = i
e.x = m
e.v = a
assert i.r.w.u.t.x.txt == "a"