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

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

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

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

class E:
    def __init__(self, txt: str):
        self.p: C = None
        self.u: B = None
        self.txt = txt

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

c.q = d
m.r = j
m.w = i
m.t = i
f.t = n
f.r = j
f.q = j
f.u = m
d.r = f
d.x = b
j.p = g
j.u = m
b.r = g
b.x = d
i.r = j
i.w = m
i.t = m
n.q = b
g.t = n
g.r = j
g.q = j
g.u = m
assert d.x.r.r.p.t.q.r.t.q.txt == "
class A:
    def __init__(self, txt: str):
        self.q: D = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.p: C = None
        self.u: B = None
        self.txt = txt

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

c.q = d
m.r = j
m.w = i
m.t = i
f.t = n
f.r = j
f.q = j
f.u = m
d.r = f
d.x = b
j.p = g
j.u = m
b.r = g
b.x = d
i.r = j
i.w = m
i.t = m
n.q = b
g.t = n
g.r = j
g.q = j
g.u = m
assert d.x.r.r.p.t.q.r.t.q.txt == "b"