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

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

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

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

k = A("k")
e = B("e")
i = C("i")
h = D("h")
m = A("m")
b = D("b")

k.y = h
k.v = m
k.t = e
k.w = b
e.z = m
e.t = i
i.v = k
i.u = k
h.v = e
m.y = b
m.w = b
m.v = k
m.t = e
b.v = e
assert i.v.w.v.t.v.w.txt == "
class A:
    def __init__(self, txt: str):
        self.y: D = None
        self.v: A = None
        self.t: B = None
        self.w: D = None
        self.txt = txt

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

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

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

k = A("k")
e = B("e")
i = C("i")
h = D("h")
m = A("m")
b = D("b")

k.y = h
k.v = m
k.t = e
k.w = b
e.z = m
e.t = i
i.v = k
i.u = k
h.v = e
m.y = b
m.w = b
m.v = k
m.t = e
b.v = e
assert i.v.w.v.t.v.w.txt == "b"