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

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

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

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

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

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

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

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

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

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

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

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

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