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

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

class C:
    def __init__(self, txt: str):
        self.z: A = None
        self.s: E = None
        self.w: C = None
        self.p: C = None
        self.x: B = None
        self.txt = txt

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

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

c = A("c")
j = B("j")
g = C("g")
d = D("d")
m = E("m")
f = D("f")
n = C("n")
e = E("e")
h = D("h")

c.q = j
c.p = j
j.v = h
j.q = c
j.r = c
g.z = c
g.s = e
g.w = n
g.p = n
g.x = j
d.y = c
d.o = c
d.q = j
d.u = n
m.r = c
m.w = n
m.t = n
m.s = g
f.y = c
f.o = c
f.q = j
f.u = n
n.z = c
n.s = e
n.w = g
n.p = g
n.x = j
e.r = c
e.w = n
e.t = g
e.s = g
h.y = c
h.o = c
h.q = j
h.u = g
assert h.q.r.q.v.y.q.q.q.q.txt == "
class A:
    def __init__(self, txt: str):
        self.q: B = None
        self.p: B = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.z: A = None
        self.s: E = None
        self.w: C = None
        self.p: C = None
        self.x: B = None
        self.txt = txt

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

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

c = A("c")
j = B("j")
g = C("g")
d = D("d")
m = E("m")
f = D("f")
n = C("n")
e = E("e")
h = D("h")

c.q = j
c.p = j
j.v = h
j.q = c
j.r = c
g.z = c
g.s = e
g.w = n
g.p = n
g.x = j
d.y = c
d.o = c
d.q = j
d.u = n
m.r = c
m.w = n
m.t = n
m.s = g
f.y = c
f.o = c
f.q = j
f.u = n
n.z = c
n.s = e
n.w = g
n.p = g
n.x = j
e.r = c
e.w = n
e.t = g
e.s = g
h.y = c
h.o = c
h.q = j
h.u = g
assert h.q.r.q.v.y.q.q.q.q.txt == "c"