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

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

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

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

k = A("k")
i = B("i")
a = C("a")
l = D("l")
h = D("h")

k.v = a
k.w = a
i.s = a
i.w = a
a.t = i
a.o = k
l.u = i
l.t = k
h.u = i
h.t = k
assert k.v.o.w.o.txt == "
class A:
    def __init__(self, txt: str):
        self.v: C = None
        self.w: C = None
        self.txt = txt

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

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

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

k = A("k")
i = B("i")
a = C("a")
l = D("l")
h = D("h")

k.v = a
k.w = a
i.s = a
i.w = a
a.t = i
a.o = k
l.u = i
l.t = k
h.u = i
h.t = k
assert k.v.o.w.o.txt == "k"