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

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

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

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

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

c = A("c")
m = B("m")
n = C("n")
h = D("h")
b = E("b")
j = C("j")
e = A("e")
i = E("i")
a = E("a")
f = B("f")

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

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

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

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

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

c = A("c")
m = B("m")
n = C("n")
h = D("h")
b = E("b")
j = C("j")
e = A("e")
i = E("i")
a = E("a")
f = B("f")

c.s = e
c.y = h
c.p = a
m.y = n
n.r = i
n.p = j
n.y = e
h.y = j
h.z = f
h.o = m
b.y = h
b.o = n
j.r = a
j.p = n
j.y = e
e.s = c
e.y = h
e.p = a
i.y = h
i.o = j
a.y = h
a.o = n
f.y = n
assert f.y.p.p.y.y.y.r.y.y.txt == "j"