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

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

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

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

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

a = A("a")
b = B("b")
h = C("h")
i = D("i")
c = E("c")
g = B("g")

a.w = c
b.z = h
b.w = h
b.y = g
b.u = g
b.o = a
h.y = c
i.u = g
c.p = h
g.z = h
g.w = h
g.y = b
g.u = b
g.o = a
assert a.w.p.y.p.y.p.txt == "
class A:
    def __init__(self, txt: str):
        self.w: E = None
        self.txt = txt

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

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

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

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

a = A("a")
b = B("b")
h = C("h")
i = D("i")
c = E("c")
g = B("g")

a.w = c
b.z = h
b.w = h
b.y = g
b.u = g
b.o = a
h.y = c
i.u = g
c.p = h
g.z = h
g.w = h
g.y = b
g.u = b
g.o = a
assert a.w.p.y.p.y.p.txt == "h"