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

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

class C:
    def __init__(self, txt: str):
        self.t: B = None
        self.v: C = None
        self.q: E = None
        self.txt = txt

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

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

n = A("n")
k = B("k")
d = C("d")
f = D("f")
b = E("b")
j = C("j")
g = B("g")
i = D("i")
h = B("h")

n.q = b
n.z = h
k.r = b
k.t = d
d.t = g
d.v = j
d.q = b
f.x = i
f.q = b
f.y = b
f.w = b
b.v = g
b.y = d
j.t = k
j.v = d
j.q = b
g.r = b
g.t = d
i.x = f
i.q = b
i.y = b
i.w = b
h.r = b
h.t = d
assert g.r.y.q.v.r.y.txt == "
class A:
    def __init__(self, txt: str):
        self.q: E = None
        self.z: B = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.t: B = None
        self.v: C = None
        self.q: E = None
        self.txt = txt

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

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

n = A("n")
k = B("k")
d = C("d")
f = D("f")
b = E("b")
j = C("j")
g = B("g")
i = D("i")
h = B("h")

n.q = b
n.z = h
k.r = b
k.t = d
d.t = g
d.v = j
d.q = b
f.x = i
f.q = b
f.y = b
f.w = b
b.v = g
b.y = d
j.t = k
j.v = d
j.q = b
g.r = b
g.t = d
i.x = f
i.q = b
i.y = b
i.w = b
h.r = b
h.t = d
assert g.r.y.q.v.r.y.txt == "d"