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

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

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

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

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

n = A("n")
j = B("j")
f = C("f")
d = D("d")
g = E("g")
i = D("i")
l = B("l")
c = C("c")

n.q = g
j.q = n
f.z = i
f.u = g
d.w = n
d.q = g
d.z = g
d.t = i
g.p = d
i.w = n
i.q = g
i.z = g
i.t = d
l.q = n
c.z = d
c.u = g
assert j.q.q.p.w.q.p.z.p.txt == "
class A:
    def __init__(self, txt: str):
        self.q: E = None
        self.txt = txt

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

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

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

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

n = A("n")
j = B("j")
f = C("f")
d = D("d")
g = E("g")
i = D("i")
l = B("l")
c = C("c")

n.q = g
j.q = n
f.z = i
f.u = g
d.w = n
d.q = g
d.z = g
d.t = i
g.p = d
i.w = n
i.q = g
i.z = g
i.t = d
l.q = n
c.z = d
c.u = g
assert j.q.q.p.w.q.p.z.p.txt == "d"