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

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

class C:
    def __init__(self, txt: str):
        self.p: E = None
        self.r: A = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.q: E = None
        self.txt = txt

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

e = A("e")
g = B("g")
i = C("i")
b = D("b")
f = E("f")

e.z = b
g.u = i
g.s = i
g.o = f
g.q = e
i.p = f
i.r = e
b.q = f
f.q = g
f.y = g
assert g.s.p.y.u.r.txt == "
class A:
    def __init__(self, txt: str):
        self.z: D = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.p: E = None
        self.r: A = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.q: E = None
        self.txt = txt

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

e = A("e")
g = B("g")
i = C("i")
b = D("b")
f = E("f")

e.z = b
g.u = i
g.s = i
g.o = f
g.q = e
i.p = f
i.r = e
b.q = f
f.q = g
f.y = g
assert g.s.p.y.u.r.txt == "e"