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

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

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

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

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

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

m.y = l
m.t = a
m.r = i
m.p = e
f.u = i
f.z = m
f.w = a
f.r = c
j.z = a
j.p = l
j.s = l
j.u = i
j.w = c
e.x = a
i.x = m
b.u = i
b.z = m
b.w = a
b.r = f
c.u = i
c.z = m
c.w = m
c.r = f
l.z = m
l.p = j
l.s = j
l.u = i
l.w = f
a.y = l
a.t = m
a.r = i
a.p = e
assert f.r.r.u.x.r.x.t.t.r.txt == "
class A:
    def __init__(self, txt: str):
        self.y: C = None
        self.t: A = None
        self.r: E = None
        self.p: D = None
        self.txt = txt

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

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

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

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

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

m.y = l
m.t = a
m.r = i
m.p = e
f.u = i
f.z = m
f.w = a
f.r = c
j.z = a
j.p = l
j.s = l
j.u = i
j.w = c
e.x = a
i.x = m
b.u = i
b.z = m
b.w = a
b.r = f
c.u = i
c.z = m
c.w = m
c.r = f
l.z = m
l.p = j
l.s = j
l.u = i
l.w = f
a.y = l
a.t = m
a.r = i
a.p = e
assert f.r.r.u.x.r.x.t.t.r.txt == "i"