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

class B:
    def __init__(self, txt: str):
        self.v: B = None
        self.q: A = None
        self.s: C = None
        self.txt = txt

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

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

d = A("d")
j = B("j")
a = C("a")
f = D("f")
m = D("m")
b = B("b")
i = B("i")
c = B("c")

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

class B:
    def __init__(self, txt: str):
        self.v: B = None
        self.q: A = None
        self.s: C = None
        self.txt = txt

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

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

d = A("d")
j = B("j")
a = C("a")
f = D("f")
m = D("m")
b = B("b")
i = B("i")
c = B("c")

d.t = a
j.v = i
j.q = d
j.s = a
a.r = m
a.w = b
f.z = m
f.u = d
f.t = i
m.z = f
m.u = d
m.t = j
b.v = c
b.q = d
b.s = a
i.v = b
i.q = d
i.s = a
c.v = j
c.q = d
c.s = a
assert m.z.t.s.r.z.z.u.txt == "d"