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

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

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

class D:
    def __init__(self, txt: str):
        self.q: A = None
        self.o: E = None
        self.z: C = None
        self.r: B = None
        self.txt = txt

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

i = A("i")
l = B("l")
b = C("b")
e = D("e")
c = E("c")
g = A("g")
h = B("h")
m = C("m")
a = B("a")

i.y = g
i.s = g
i.r = l
l.u = b
b.r = i
b.x = m
e.q = g
e.o = c
e.z = m
e.r = h
c.v = e
c.o = e
c.p = e
g.y = i
g.s = i
g.r = l
h.u = b
m.r = i
m.x = b
a.u = m
assert m.r.r.u.r.txt == "
class A:
    def __init__(self, txt: str):
        self.y: A = None
        self.s: A = None
        self.r: B = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.q: A = None
        self.o: E = None
        self.z: C = None
        self.r: B = None
        self.txt = txt

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

i = A("i")
l = B("l")
b = C("b")
e = D("e")
c = E("c")
g = A("g")
h = B("h")
m = C("m")
a = B("a")

i.y = g
i.s = g
i.r = l
l.u = b
b.r = i
b.x = m
e.q = g
e.o = c
e.z = m
e.r = h
c.v = e
c.o = e
c.p = e
g.y = i
g.s = i
g.r = l
h.u = b
m.r = i
m.x = b
a.u = m
assert m.r.r.u.r.txt == "i"