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

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

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

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

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

m = A("m")
c = B("c")
b = C("b")
a = D("a")
j = E("j")

m.s = c
m.t = c
m.v = c
m.o = j
m.x = j
c.x = j
c.y = m
b.q = c
a.p = b
a.w = m
j.s = m
j.y = c
assert c.x.s.x.y.txt == "
class A:
    def __init__(self, txt: str):
        self.s: B = None
        self.t: B = None
        self.o: E = None
        self.v: B = None
        self.x: E = None
        self.txt = txt

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

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

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

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

m = A("m")
c = B("c")
b = C("b")
a = D("a")
j = E("j")

m.s = c
m.t = c
m.v = c
m.o = j
m.x = j
c.x = j
c.y = m
b.q = c
a.p = b
a.w = m
j.s = m
j.y = c
assert c.x.s.x.y.txt == "c"