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

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

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

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

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

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

h.z = c
h.x = c
h.q = i
i.r = c
c.w = b
n.t = j
n.p = c
n.y = i
b.p = c
b.w = n
l.p = c
l.w = n
f.z = c
f.x = c
f.q = i
j.z = c
j.x = c
j.q = i
assert b.p.w.p.w.w.txt == "
class A:
    def __init__(self, txt: str):
        self.z: C = None
        self.q: B = None
        self.x: C = None
        self.txt = txt

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

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

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

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

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

h.z = c
h.x = c
h.q = i
i.r = c
c.w = b
n.t = j
n.p = c
n.y = i
b.p = c
b.w = n
l.p = c
l.w = n
f.z = c
f.x = c
f.q = i
j.z = c
j.x = c
j.q = i
assert b.p.w.p.w.w.txt == "n"