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

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

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

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

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

m = A("m")
e = B("e")
h = C("h")
d = D("d")
k = E("k")
j = C("j")
c = D("c")
g = E("g")
b = D("b")
l = B("l")

m.o = d
e.p = l
e.x = l
h.t = b
h.r = k
d.w = m
d.q = m
d.u = k
d.t = j
k.u = h
k.x = b
j.t = b
j.r = g
c.w = m
c.q = m
c.u = k
c.t = h
g.u = j
g.x = d
b.w = m
b.q = m
b.u = g
b.t = j
l.p = e
l.x = e
assert d.t.t.t.r.u.r.txt == "
class A:
    def __init__(self, txt: str):
        self.o: D = None
        self.txt = txt

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

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

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

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

m = A("m")
e = B("e")
h = C("h")
d = D("d")
k = E("k")
j = C("j")
c = D("c")
g = E("g")
b = D("b")
l = B("l")

m.o = d
e.p = l
e.x = l
h.t = b
h.r = k
d.w = m
d.q = m
d.u = k
d.t = j
k.u = h
k.x = b
j.t = b
j.r = g
c.w = m
c.q = m
c.u = k
c.t = h
g.u = j
g.x = d
b.w = m
b.q = m
b.u = g
b.t = j
l.p = e
l.x = e
assert d.t.t.t.r.u.r.txt == "g"