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

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

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

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

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

g = A("g")
f = B("f")
b = C("b")
j = D("j")
c = E("c")

g.v = f
g.x = j
f.w = c
f.y = j
f.x = g
f.u = g
f.p = g
b.v = c
j.r = b
c.x = j
c.p = b
c.z = b
c.t = f
assert c.z.v.x.txt == "
class A:
    def __init__(self, txt: str):
        self.v: B = None
        self.x: D = None
        self.txt = txt

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

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

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

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

g = A("g")
f = B("f")
b = C("b")
j = D("j")
c = E("c")

g.v = f
g.x = j
f.w = c
f.y = j
f.x = g
f.u = g
f.p = g
b.v = c
j.r = b
c.x = j
c.p = b
c.z = b
c.t = f
assert c.z.v.x.txt == "j"