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

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

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

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

c = A("c")
e = B("e")
h = C("h")
b = D("b")
m = A("m")

c.z = b
c.t = m
c.o = m
e.y = b
h.v = m
h.y = b
b.o = h
b.x = e
m.z = b
m.t = c
m.o = c
assert h.y.o.y.x.txt == "
class A:
    def __init__(self, txt: str):
        self.z: D = None
        self.t: A = None
        self.o: A = None
        self.txt = txt

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

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

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

c = A("c")
e = B("e")
h = C("h")
b = D("b")
m = A("m")

c.z = b
c.t = m
c.o = m
e.y = b
h.v = m
h.y = b
b.o = h
b.x = e
m.z = b
m.t = c
m.o = c
assert h.y.o.y.x.txt == "e"