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

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

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

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

class E:
    def __init__(self, txt: str):
        self.x: D = None
        self.z: C = None
        self.q: E = None
        self.v: D = None
        self.t: A = None
        self.txt = txt

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

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

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

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

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

class E:
    def __init__(self, txt: str):
        self.x: D = None
        self.z: C = None
        self.q: E = None
        self.v: D = None
        self.t: A = None
        self.txt = txt

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

j.t = f
d.t = i
d.q = f
i.r = d
f.q = a
f.x = i
f.t = i
f.v = i
c.x = f
c.v = f
c.z = i
c.q = g
c.t = m
a.t = i
a.q = f
g.x = f
g.v = f
g.z = i
g.q = c
g.t = m
m.t = f
l.r = a
assert c.q.t.t.x.r.q.q.txt == "a"