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

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

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

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

c = A("c")
e = B("e")
i = C("i")
n = D("n")
m = D("m")

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

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

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

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

c = A("c")
e = B("e")
i = C("i")
n = D("n")
m = D("m")

c.s = e
c.v = e
e.t = c
i.r = e
n.x = c
n.o = e
n.p = i
m.x = c
m.o = e
m.p = i
assert n.o.t.v.t.v.txt == "e"