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

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

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

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

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

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

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

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

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

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

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

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

a.o = f
a.r = g
a.s = b
a.x = i
m.o = a
m.t = a
m.w = e
i.s = f
b.x = i
b.r = m
b.z = n
n.x = b
f.x = i
f.r = e
f.z = n
g.o = j
g.r = a
g.s = b
g.x = i
j.x = i
j.r = m
j.z = n
c.o = g
c.t = a
c.w = m
e.o = g
e.t = a
e.w = c
assert g.o.z.x.x.s.x.s.r.txt == "e"