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

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

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

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

class E:
    def __init__(self, txt: str):
        self.w: A = None
        self.txt = txt

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

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

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

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

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

class E:
    def __init__(self, txt: str):
        self.w: A = None
        self.txt = txt

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

c.p = i
i.z = g
g.v = c
g.q = c
g.w = j
g.x = m
g.s = m
j.o = c
j.z = m
j.w = g
m.w = c
assert j.o.p.z.x.w.txt == "c"