class A:
    def __init__(self, txt: str):
        self.w: E = None
        self.q: B = None
        self.t: D = None
        self.p: E = None
        self.txt = txt

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

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

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

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

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

i.w = h
i.p = h
i.q = f
i.t = g
f.p = i
f.r = i
f.y = i
m.w = g
m.r = h
g.x = h
g.p = h
h.u = g
h.w = g
h.v = m
h.o = f
h.z = i
assert i.t.p.z.q.txt == "
class A:
    def __init__(self, txt: str):
        self.w: E = None
        self.q: B = None
        self.t: D = None
        self.p: E = None
        self.txt = txt

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

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

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

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

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

i.w = h
i.p = h
i.q = f
i.t = g
f.p = i
f.r = i
f.y = i
m.w = g
m.r = h
g.x = h
g.p = h
h.u = g
h.w = g
h.v = m
h.o = f
h.z = i
assert i.t.p.z.q.txt == "f"