class A:
    def __init__(self, txt: str):
        self.y: B = None
        self.r: E = None
        self.q: A = None
        self.w: E = None
        self.p: D = None
        self.txt = txt

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

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

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

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

j = A("j")
n = B("n")
a = C("a")
h = D("h")
m = E("m")
b = A("b")
g = B("g")
d = C("d")

j.y = g
j.r = m
j.w = m
j.q = b
j.p = h
n.q = g
n.t = g
n.v = h
n.w = m
a.q = m
a.s = j
a.u = h
h.r = a
m.t = h
m.p = h
b.y = n
b.r = m
b.w = m
b.q = j
b.p = h
g.q = n
g.t = n
g.v = h
g.w = m
d.q = m
d.s = b
d.u = h
assert g.q.q.v.r.txt == "
class A:
    def __init__(self, txt: str):
        self.y: B = None
        self.r: E = None
        self.q: A = None
        self.w: E = None
        self.p: D = None
        self.txt = txt

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

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

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

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

j = A("j")
n = B("n")
a = C("a")
h = D("h")
m = E("m")
b = A("b")
g = B("g")
d = C("d")

j.y = g
j.r = m
j.w = m
j.q = b
j.p = h
n.q = g
n.t = g
n.v = h
n.w = m
a.q = m
a.s = j
a.u = h
h.r = a
m.t = h
m.p = h
b.y = n
b.r = m
b.w = m
b.q = j
b.p = h
g.q = n
g.t = n
g.v = h
g.w = m
d.q = m
d.s = b
d.u = h
assert g.q.q.v.r.txt == "a"