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

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

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

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

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

j = A("j")
f = B("f")
h = C("h")
i = D("i")
c = E("c")
b = B("b")

j.p = i
f.q = i
f.y = i
f.o = h
f.s = h
f.p = h
h.p = c
h.y = i
i.s = b
c.t = i
c.o = h
b.q = i
b.y = i
b.o = h
b.s = h
b.p = h
assert h.y.s.s.y.s.s.txt == "
class A:
    def __init__(self, txt: str):
        self.p: D = None
        self.txt = txt

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

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

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

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

j = A("j")
f = B("f")
h = C("h")
i = D("i")
c = E("c")
b = B("b")

j.p = i
f.q = i
f.y = i
f.o = h
f.s = h
f.p = h
h.p = c
h.y = i
i.s = b
c.t = i
c.o = h
b.q = i
b.y = i
b.o = h
b.s = h
b.p = h
assert h.y.s.s.y.s.s.txt == "h"