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

class B:
    def __init__(self, txt: str):
        self.u: E = None
        self.q: C = None
        self.w: A = None
        self.y: C = None
        self.v: E = None
        self.txt = txt

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

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

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

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

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

class B:
    def __init__(self, txt: str):
        self.u: E = None
        self.q: C = None
        self.w: A = None
        self.y: C = None
        self.v: E = None
        self.txt = txt

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

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

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

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

f.u = c
j.u = l
j.v = l
j.q = g
j.y = g
j.w = m
g.q = l
b.o = c
b.p = d
b.q = l
l.s = b
l.w = f
l.t = d
l.v = m
l.x = m
d.q = l
c.o = b
c.p = n
c.q = l
i.u = l
i.v = l
i.q = d
i.w = m
i.y = n
m.u = c
n.q = l
assert m.u.o.p.q.s.p.q.s.p.txt == "d"