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

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

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

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

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

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

b.o = c
b.z = f
b.s = a
h.r = b
h.p = b
f.y = j
f.z = d
n.p = h
a.p = k
j.p = h
k.y = n
k.z = d
c.o = b
c.z = k
c.s = a
d.y = j
d.z = f
assert b.o.o.s.p.txt == "
class A:
    def __init__(self, txt: str):
        self.o: A = None
        self.z: C = None
        self.s: E = None
        self.txt = txt

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

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

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

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

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

b.o = c
b.z = f
b.s = a
h.r = b
h.p = b
f.y = j
f.z = d
n.p = h
a.p = k
j.p = h
k.y = n
k.z = d
c.o = b
c.z = k
c.s = a
d.y = j
d.z = f
assert b.o.o.s.p.txt == "k"