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

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

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

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

k = A("k")
m = B("m")
j = C("j")
e = D("e")
h = D("h")
f = C("f")

k.x = m
k.y = h
k.z = e
m.v = h
j.w = e
j.s = k
e.r = m
e.y = m
e.u = j
h.r = m
h.y = m
h.u = f
f.w = e
f.s = k
assert m.v.r.v.y.txt == "
class A:
    def __init__(self, txt: str):
        self.x: B = None
        self.y: D = None
        self.z: D = None
        self.txt = txt

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

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

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

k = A("k")
m = B("m")
j = C("j")
e = D("e")
h = D("h")
f = C("f")

k.x = m
k.y = h
k.z = e
m.v = h
j.w = e
j.s = k
e.r = m
e.y = m
e.u = j
h.r = m
h.y = m
h.u = f
f.w = e
f.s = k
assert m.v.r.v.y.txt == "m"