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

class B:
    def __init__(self, txt: str):
        self.x: E = None
        self.q: E = None
        self.y: E = 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.r: B = None
        self.q: C = None
        self.s: C = None
        self.z: B = None
        self.u: A = None
        self.txt = txt

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

b = A("b")
d = B("d")
m = C("m")
h = D("h")
k = E("k")
i = C("i")

b.y = i
b.r = i
b.u = h
b.o = h
d.x = k
d.q = k
d.y = k
m.y = k
h.r = d
h.z = d
h.q = i
h.s = m
h.u = b
k.o = h
k.w = d
k.p = i
i.y = k
assert k.p.y.p.txt == "
class A:
    def __init__(self, txt: str):
        self.y: C = None
        self.u: D = None
        self.o: D = None
        self.r: C = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.x: E = None
        self.q: E = None
        self.y: E = 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.r: B = None
        self.q: C = None
        self.s: C = None
        self.z: B = None
        self.u: A = None
        self.txt = txt

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

b = A("b")
d = B("d")
m = C("m")
h = D("h")
k = E("k")
i = C("i")

b.y = i
b.r = i
b.u = h
b.o = h
d.x = k
d.q = k
d.y = k
m.y = k
h.r = d
h.z = d
h.q = i
h.s = m
h.u = b
k.o = h
k.w = d
k.p = i
i.y = k
assert k.p.y.p.txt == "i"