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

class B:
    def __init__(self, txt: str):
        self.s: C = None
        self.t: D = None
        self.w: E = None
        self.y: C = None
        self.q: C = None
        self.txt = txt

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

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

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

c = A("c")
b = B("b")
e = C("e")
f = D("f")
a = E("a")

c.p = b
c.s = e
b.s = e
b.y = e
b.q = e
b.t = f
b.w = a
e.o = b
f.t = c
a.u = b
assert a.u.y.o.t.t.txt == "
class A:
    def __init__(self, txt: str):
        self.p: B = None
        self.s: C = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.s: C = None
        self.t: D = None
        self.w: E = None
        self.y: C = None
        self.q: C = None
        self.txt = txt

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

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

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

c = A("c")
b = B("b")
e = C("e")
f = D("f")
a = E("a")

c.p = b
c.s = e
b.s = e
b.y = e
b.q = e
b.t = f
b.w = a
e.o = b
f.t = c
a.u = b
assert a.u.y.o.t.t.txt == "c"