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

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

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

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

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

g = A("g")
m = B("m")
k = C("k")
h = D("h")
i = E("i")
a = D("a")
j = D("j")
n = C("n")

g.v = m
m.w = a
m.v = j
m.q = g
k.s = g
k.q = g
k.x = n
h.o = g
h.y = g
h.s = g
i.t = m
i.x = a
a.o = g
a.y = g
a.s = g
j.o = g
j.y = g
j.s = g
n.s = g
n.q = g
n.x = k
assert h.s.v.v.txt == "
class A:
    def __init__(self, txt: str):
        self.v: B = None
        self.txt = txt

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

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

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

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

g = A("g")
m = B("m")
k = C("k")
h = D("h")
i = E("i")
a = D("a")
j = D("j")
n = C("n")

g.v = m
m.w = a
m.v = j
m.q = g
k.s = g
k.q = g
k.x = n
h.o = g
h.y = g
h.s = g
i.t = m
i.x = a
a.o = g
a.y = g
a.s = g
j.o = g
j.y = g
j.s = g
n.s = g
n.q = g
n.x = k
assert h.s.v.v.txt == "j"