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

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

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

class D:
    def __init__(self, txt: str):
        self.y: B = None
        self.x: E = None
        self.r: B = None
        self.o: B = None
        self.s: C = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.p: B = None
        self.y: C = None
        self.u: A = None
        self.r: E = None
        self.o: C = None
        self.txt = txt

a = A("a")
d = B("d")
m = C("m")
e = D("e")
g = E("g")
i = A("i")
f = E("f")
k = D("k")
c = B("c")

a.s = i
a.u = d
d.s = g
d.x = c
m.q = e
m.r = i
e.y = d
e.o = d
e.x = g
e.r = c
e.s = m
g.p = c
g.y = m
g.o = m
g.u = i
g.r = f
i.s = a
i.u = d
f.p = d
f.y = m
f.o = m
f.u = i
f.r = g
k.y = c
k.r = c
k.x = f
k.o = d
k.s = m
c.s = g
c.x = d
assert e.s.r.s.u.txt == "
class A:
    def __init__(self, txt: str):
        self.s: A = None
        self.u: B = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.y: B = None
        self.x: E = None
        self.r: B = None
        self.o: B = None
        self.s: C = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.p: B = None
        self.y: C = None
        self.u: A = None
        self.r: E = None
        self.o: C = None
        self.txt = txt

a = A("a")
d = B("d")
m = C("m")
e = D("e")
g = E("g")
i = A("i")
f = E("f")
k = D("k")
c = B("c")

a.s = i
a.u = d
d.s = g
d.x = c
m.q = e
m.r = i
e.y = d
e.o = d
e.x = g
e.r = c
e.s = m
g.p = c
g.y = m
g.o = m
g.u = i
g.r = f
i.s = a
i.u = d
f.p = d
f.y = m
f.o = m
f.u = i
f.r = g
k.y = c
k.r = c
k.x = f
k.o = d
k.s = m
c.s = g
c.x = d
assert e.s.r.s.u.txt == "d"