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

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

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

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

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

f = A("f")
i = B("i")
j = C("j")
h = D("h")
g = E("g")

f.y = j
f.z = j
f.x = g
f.t = h
i.x = f
i.z = f
i.s = j
i.w = h
i.q = h
j.q = h
j.z = h
j.w = g
j.r = f
j.x = f
h.w = i
g.p = h
g.t = j
assert i.x.t.w.z.z.txt == "
class A:
    def __init__(self, txt: str):
        self.y: C = None
        self.x: E = None
        self.z: C = None
        self.t: D = None
        self.txt = txt

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

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

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

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

f = A("f")
i = B("i")
j = C("j")
h = D("h")
g = E("g")

f.y = j
f.z = j
f.x = g
f.t = h
i.x = f
i.z = f
i.s = j
i.w = h
i.q = h
j.q = h
j.z = h
j.w = g
j.r = f
j.x = f
h.w = i
g.p = h
g.t = j
assert i.x.t.w.z.z.txt == "j"