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

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

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

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

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

m = A("m")
l = B("l")
n = C("n")
c = D("c")
j = E("j")
i = B("i")
k = A("k")

m.o = c
m.y = l
l.w = i
l.y = i
l.r = i
n.s = i
n.w = j
c.t = k
c.q = k
c.z = i
c.o = l
j.z = n
j.q = k
i.w = l
i.y = l
i.r = l
k.o = c
k.y = l
assert i.r.w.y.r.r.r.r.txt == "
class A:
    def __init__(self, txt: str):
        self.o: D = None
        self.y: B = None
        self.txt = txt

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

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

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

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

m = A("m")
l = B("l")
n = C("n")
c = D("c")
j = E("j")
i = B("i")
k = A("k")

m.o = c
m.y = l
l.w = i
l.y = i
l.r = i
n.s = i
n.w = j
c.t = k
c.q = k
c.z = i
c.o = l
j.z = n
j.q = k
i.w = l
i.y = l
i.r = l
k.o = c
k.y = l
assert i.r.w.y.r.r.r.r.txt == "l"