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

class B:
    def __init__(self, txt: str):
        self.p: B = None
        self.y: D = None
        self.u: C = None
        self.x: B = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.y: E = None
        self.u: E = None
        self.z: B = None
        self.txt = txt

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

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

c.o = n
c.u = j
n.p = b
n.x = b
n.y = e
n.u = g
g.s = b
e.y = m
e.u = m
e.z = n
m.o = b
m.r = e
m.w = h
m.v = g
m.q = j
j.o = n
j.u = c
b.p = n
b.x = n
b.y = e
b.u = h
h.s = n
assert c.o.x.u.s.txt == "
class A:
    def __init__(self, txt: str):
        self.o: B = None
        self.u: A = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.p: B = None
        self.y: D = None
        self.u: C = None
        self.x: B = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.y: E = None
        self.u: E = None
        self.z: B = None
        self.txt = txt

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

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

c.o = n
c.u = j
n.p = b
n.x = b
n.y = e
n.u = g
g.s = b
e.y = m
e.u = m
e.z = n
m.o = b
m.r = e
m.w = h
m.v = g
m.q = j
j.o = n
j.u = c
b.p = n
b.x = n
b.y = e
b.u = h
h.s = n
assert c.o.x.u.s.txt == "n"