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

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

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

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

class E:
    def __init__(self, txt: str):
        self.w: D = None
        self.p: D = None
        self.o: A = None
        self.r: A = None
        self.u: A = None
        self.txt = txt

d = A("d")
m = B("m")
b = C("b")
e = D("e")
g = E("g")
f = A("f")
l = B("l")
a = D("a")

d.x = a
d.r = a
d.w = f
d.s = g
m.r = g
b.o = d
e.o = b
g.w = a
g.p = e
g.o = f
g.r = f
g.u = d
f.x = e
f.r = a
f.w = d
f.s = g
l.r = g
a.o = b
assert m.r.u.x.txt == "
class A:
    def __init__(self, txt: str):
        self.x: D = None
        self.r: D = None
        self.w: A = None
        self.s: E = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.w: D = None
        self.p: D = None
        self.o: A = None
        self.r: A = None
        self.u: A = None
        self.txt = txt

d = A("d")
m = B("m")
b = C("b")
e = D("e")
g = E("g")
f = A("f")
l = B("l")
a = D("a")

d.x = a
d.r = a
d.w = f
d.s = g
m.r = g
b.o = d
e.o = b
g.w = a
g.p = e
g.o = f
g.r = f
g.u = d
f.x = e
f.r = a
f.w = d
f.s = g
l.r = g
a.o = b
assert m.r.u.x.txt == "a"