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

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

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

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

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

c.v = e
e.v = c
k.x = e
k.s = c
k.o = i
i.x = e
assert k.o.x.v.v.txt == "
class A:
    def __init__(self, txt: str):
        self.v: B = None
        self.txt = txt

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

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

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

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

c.v = e
e.v = c
k.x = e
k.s = c
k.o = i
i.x = e
assert k.o.x.v.v.txt == "e"