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

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

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

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

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

b.z = f
b.y = e
b.u = m
b.x = m
h.u = b
f.o = b
i.s = e
i.r = f
m.z = f
m.y = i
m.u = b
m.x = b
e.s = i
e.r = f
assert i.s.r.o.z.txt == "
class A:
    def __init__(self, txt: str):
        self.z: C = None
        self.y: D = None
        self.u: A = None
        self.x: A = None
        self.txt = txt

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

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

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

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

b.z = f
b.y = e
b.u = m
b.x = m
h.u = b
f.o = b
i.s = e
i.r = f
m.z = f
m.y = i
m.u = b
m.x = b
e.s = i
e.r = f
assert i.s.r.o.z.txt == "f"