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

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

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

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

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

g = A("g")
m = B("m")
e = C("e")
j = D("j")
i = E("i")
c = A("c")

g.y = i
g.u = i
g.v = e
g.p = m
m.x = j
e.s = i
j.s = i
j.p = e
i.z = c
i.o = m
c.y = i
c.u = i
c.v = e
c.p = m
assert c.v.s.o.txt == "
class A:
    def __init__(self, txt: str):
        self.y: E = None
        self.v: C = None
        self.u: E = None
        self.p: B = None
        self.txt = txt

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

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

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

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

g = A("g")
m = B("m")
e = C("e")
j = D("j")
i = E("i")
c = A("c")

g.y = i
g.u = i
g.v = e
g.p = m
m.x = j
e.s = i
j.s = i
j.p = e
i.z = c
i.o = m
c.y = i
c.u = i
c.v = e
c.p = m
assert c.v.s.o.txt == "m"