class A:
    def __init__(self, txt: str):
        self.p: B = None
        self.u: C = None
        self.z: C = None
        self.t: E = None
        self.q: C = None
        self.txt = txt

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

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

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

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

f = A("f")
j = B("j")
i = C("i")
d = D("d")
b = E("b")
l = A("l")
n = E("n")

f.p = j
f.u = i
f.z = i
f.q = i
f.t = b
j.r = f
j.o = f
j.y = d
i.o = j
i.t = j
i.p = l
i.z = n
d.s = b
b.w = d
l.p = j
l.u = i
l.z = i
l.q = i
l.t = n
n.w = d
assert d.s.w.s.w.s.w.s.txt == "
class A:
    def __init__(self, txt: str):
        self.p: B = None
        self.u: C = None
        self.z: C = None
        self.t: E = None
        self.q: C = None
        self.txt = txt

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

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

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

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

f = A("f")
j = B("j")
i = C("i")
d = D("d")
b = E("b")
l = A("l")
n = E("n")

f.p = j
f.u = i
f.z = i
f.q = i
f.t = b
j.r = f
j.o = f
j.y = d
i.o = j
i.t = j
i.p = l
i.z = n
d.s = b
b.w = d
l.p = j
l.u = i
l.z = i
l.q = i
l.t = n
n.w = d
assert d.s.w.s.w.s.w.s.txt == "b"