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

class B:
    def __init__(self, txt: str):
        self.t: A = None
        self.r: D = None
        self.s: E = None
        self.z: B = None
        self.y: D = None
        self.txt = txt

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

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

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

c = A("c")
a = B("a")
n = C("n")
d = D("d")
m = E("m")
g = B("g")
i = D("i")
j = B("j")

c.q = a
a.t = c
a.r = i
a.s = m
a.z = j
a.y = d
n.x = j
d.r = a
d.t = a
m.v = g
g.t = c
g.r = d
g.s = m
g.z = a
g.y = i
i.r = a
i.t = g
j.t = c
j.r = i
j.s = m
j.z = g
j.y = d
assert d.r.z.z.r.t.z.txt == "
class A:
    def __init__(self, txt: str):
        self.q: B = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.t: A = None
        self.r: D = None
        self.s: E = None
        self.z: B = None
        self.y: D = None
        self.txt = txt

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

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

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

c = A("c")
a = B("a")
n = C("n")
d = D("d")
m = E("m")
g = B("g")
i = D("i")
j = B("j")

c.q = a
a.t = c
a.r = i
a.s = m
a.z = j
a.y = d
n.x = j
d.r = a
d.t = a
m.v = g
g.t = c
g.r = d
g.s = m
g.z = a
g.y = i
i.r = a
i.t = g
j.t = c
j.r = i
j.s = m
j.z = g
j.y = d
assert d.r.z.z.r.t.z.txt == "j"