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

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

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

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

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

j = A("j")
k = B("k")
h = C("h")
n = D("n")
e = E("e")
c = A("c")
d = B("d")

j.s = e
k.s = e
k.p = e
k.o = n
h.v = n
n.q = e
e.y = n
e.t = n
c.s = e
d.s = e
d.p = e
d.o = n
assert c.s.t.q.txt == "
class A:
    def __init__(self, txt: str):
        self.s: E = None
        self.txt = txt

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

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

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

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

j = A("j")
k = B("k")
h = C("h")
n = D("n")
e = E("e")
c = A("c")
d = B("d")

j.s = e
k.s = e
k.p = e
k.o = n
h.v = n
n.q = e
e.y = n
e.t = n
c.s = e
d.s = e
d.p = e
d.o = n
assert c.s.t.q.txt == "e"