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

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

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

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

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

c.s = h
c.z = e
c.v = e
a.s = h
h.r = e
h.x = i
i.v = k
i.w = k
i.o = k
e.s = h
e.z = c
e.v = c
k.v = i
k.w = i
k.o = i
assert i.w.w.v.txt == "
class A:
    def __init__(self, txt: str):
        self.s: C = None
        self.z: A = None
        self.v: A = None
        self.txt = txt

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

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

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

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

c.s = h
c.z = e
c.v = e
a.s = h
h.r = e
h.x = i
i.v = k
i.w = k
i.o = k
e.s = h
e.z = c
e.v = c
k.v = i
k.w = i
k.o = i
assert i.w.w.v.txt == "k"