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

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

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

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

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

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

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

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

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

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

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

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

h.q = j
h.x = c
h.u = c
c.z = m
c.y = e
c.s = g
c.p = g
c.o = g
j.v = n
g.u = h
g.v = c
b.q = c
b.v = g
b.r = j
b.u = i
i.v = b
m.v = b
e.q = m
e.x = c
e.u = c
n.q = c
n.v = g
n.r = j
n.u = i
assert h.x.p.u.q.v.q.txt == "c"