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

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

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

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

c = A("c")
h = B("h")
e = C("e")
n = D("n")

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

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

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

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

c = A("c")
h = B("h")
e = C("e")
n = D("n")

c.r = n
h.x = e
h.o = c
h.s = c
e.p = c
e.t = h
e.o = n
e.v = n
n.x = c
n.r = c
n.z = e
n.o = h
assert n.o.x.t.txt == "h"