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

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

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

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

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

f = A("f")
a = B("a")
l = C("l")
b = D("b")
i = E("i")

f.o = b
f.x = l
f.y = a
f.z = i
f.u = i
a.x = b
l.z = i
l.o = i
l.y = f
b.p = l
i.u = a
i.r = b
i.s = b
assert b.p.z.r.p.y.txt == "
class A:
    def __init__(self, txt: str):
        self.o: D = None
        self.x: C = None
        self.y: B = None
        self.z: E = None
        self.u: E = None
        self.txt = txt

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

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

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

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

f = A("f")
a = B("a")
l = C("l")
b = D("b")
i = E("i")

f.o = b
f.x = l
f.y = a
f.z = i
f.u = i
a.x = b
l.z = i
l.o = i
l.y = f
b.p = l
i.u = a
i.r = b
i.s = b
assert b.p.z.r.p.y.txt == "f"