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

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

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

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

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

l = A("l")
a = B("a")
m = C("m")
f = D("f")
j = E("j")
d = A("d")

l.r = m
l.x = j
l.y = d
a.u = d
a.o = d
a.s = j
a.w = l
m.u = j
m.t = j
m.o = f
m.y = d
f.u = d
f.q = a
f.s = a
f.r = m
f.w = j
j.r = a
d.r = m
d.x = j
d.y = l
assert m.y.r.u.txt == "
class A:
    def __init__(self, txt: str):
        self.r: C = None
        self.x: E = None
        self.y: A = None
        self.txt = txt

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

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

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

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

l = A("l")
a = B("a")
m = C("m")
f = D("f")
j = E("j")
d = A("d")

l.r = m
l.x = j
l.y = d
a.u = d
a.o = d
a.s = j
a.w = l
m.u = j
m.t = j
m.o = f
m.y = d
f.u = d
f.q = a
f.s = a
f.r = m
f.w = j
j.r = a
d.r = m
d.x = j
d.y = l
assert m.y.r.u.txt == "j"