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

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

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

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

i = A("i")
c = B("c")
b = C("b")
f = D("f")
m = B("m")
e = C("e")
n = D("n")
j = C("j")

i.u = j
i.w = m
i.v = f
c.z = e
c.v = m
c.w = n
b.q = c
b.v = c
b.p = e
b.t = m
f.s = i
f.w = n
f.y = n
f.x = m
m.z = e
m.v = c
m.w = n
e.q = m
e.t = m
e.v = c
e.p = j
n.s = i
n.w = f
n.y = f
n.x = c
j.q = m
j.t = m
j.v = c
j.p = e
assert m.v.w.s.v.s.txt == "
class A:
    def __init__(self, txt: str):
        self.u: C = None
        self.w: B = None
        self.v: D = None
        self.txt = txt

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

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

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

i = A("i")
c = B("c")
b = C("b")
f = D("f")
m = B("m")
e = C("e")
n = D("n")
j = C("j")

i.u = j
i.w = m
i.v = f
c.z = e
c.v = m
c.w = n
b.q = c
b.v = c
b.p = e
b.t = m
f.s = i
f.w = n
f.y = n
f.x = m
m.z = e
m.v = c
m.w = n
e.q = m
e.t = m
e.v = c
e.p = j
n.s = i
n.w = f
n.y = f
n.x = c
j.q = m
j.t = m
j.v = c
j.p = e
assert m.v.w.s.v.s.txt == "i"