class A:
    def __init__(self, txt: str):
        self.o: A = None
        self.txt = txt

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

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

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

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

d = A("d")
c = B("c")
k = C("k")
i = D("i")
j = E("j")
g = C("g")
e = A("e")
n = E("n")

d.o = e
c.u = d
c.v = i
c.z = j
k.v = c
k.q = g
i.r = c
i.w = c
j.p = n
j.t = n
j.q = k
j.w = k
g.v = c
g.q = k
e.o = d
n.p = j
n.t = j
n.q = g
n.w = k
assert j.q.q.q.v.u.o.o.o.txt == "
class A:
    def __init__(self, txt: str):
        self.o: A = None
        self.txt = txt

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

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

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

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

d = A("d")
c = B("c")
k = C("k")
i = D("i")
j = E("j")
g = C("g")
e = A("e")
n = E("n")

d.o = e
c.u = d
c.v = i
c.z = j
k.v = c
k.q = g
i.r = c
i.w = c
j.p = n
j.t = n
j.q = k
j.w = k
g.v = c
g.q = k
e.o = d
n.p = j
n.t = j
n.q = g
n.w = k
assert j.q.q.q.v.u.o.o.o.txt == "e"