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

class B:
    def __init__(self, txt: str):
        self.r: E = None
        self.t: C = None
        self.u: B = None
        self.o: D = None
        self.p: D = None
        self.txt = txt

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

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

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

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

b.y = a
b.p = c
b.x = c
a.r = f
a.t = j
a.u = n
a.o = c
a.p = c
j.o = f
j.z = f
j.p = a
j.y = c
c.z = a
c.p = a
f.s = j
f.y = j
f.x = b
n.r = f
n.t = j
n.u = a
n.o = c
n.p = c
assert c.z.r.y.txt == "
class A:
    def __init__(self, txt: str):
        self.y: B = None
        self.p: D = None
        self.x: D = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.r: E = None
        self.t: C = None
        self.u: B = None
        self.o: D = None
        self.p: D = None
        self.txt = txt

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

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

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

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

b.y = a
b.p = c
b.x = c
a.r = f
a.t = j
a.u = n
a.o = c
a.p = c
j.o = f
j.z = f
j.p = a
j.y = c
c.z = a
c.p = a
f.s = j
f.y = j
f.x = b
n.r = f
n.t = j
n.u = a
n.o = c
n.p = c
assert c.z.r.y.txt == "j"