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

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

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

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

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

h = A("h")
b = B("b")
d = C("d")
m = D("m")
a = E("a")
e = D("e")
j = C("j")
c = D("c")
k = E("k")

h.v = m
h.p = b
b.q = e
d.t = h
d.v = j
d.r = k
m.u = b
m.o = h
m.w = d
a.v = b
e.u = b
e.o = h
e.w = j
j.t = h
j.v = d
j.r = a
c.u = b
c.o = h
c.w = j
k.v = b
assert j.r.v.q.txt == "
class A:
    def __init__(self, txt: str):
        self.v: D = None
        self.p: B = None
        self.txt = txt

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

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

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

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

h = A("h")
b = B("b")
d = C("d")
m = D("m")
a = E("a")
e = D("e")
j = C("j")
c = D("c")
k = E("k")

h.v = m
h.p = b
b.q = e
d.t = h
d.v = j
d.r = k
m.u = b
m.o = h
m.w = d
a.v = b
e.u = b
e.o = h
e.w = j
j.t = h
j.v = d
j.r = a
c.u = b
c.o = h
c.w = j
k.v = b
assert j.r.v.q.txt == "e"