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

class B:
    def __init__(self, txt: str):
        self.p: A = None
        self.z: E = None
        self.u: E = None
        self.r: A = None
        self.q: E = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.s: A = None
        self.t: E = None
        self.p: A = None
        self.y: B = None
        self.o: C = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.x: C = None
        self.r: C = None
        self.w: A = None
        self.v: C = None
        self.s: A = None
        self.txt = txt

f = A("f")
i = B("i")
l = C("l")
d = D("d")
g = E("g")

f.y = l
i.p = f
i.r = f
i.z = g
i.u = g
i.q = g
l.q = d
l.y = d
d.s = f
d.p = f
d.t = g
d.y = i
d.o = l
g.x = l
g.r = l
g.v = l
g.w = f
g.s = f
assert f.y.q.y.txt == "
class A:
    def __init__(self, txt: str):
        self.y: C = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.p: A = None
        self.z: E = None
        self.u: E = None
        self.r: A = None
        self.q: E = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.s: A = None
        self.t: E = None
        self.p: A = None
        self.y: B = None
        self.o: C = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.x: C = None
        self.r: C = None
        self.w: A = None
        self.v: C = None
        self.s: A = None
        self.txt = txt

f = A("f")
i = B("i")
l = C("l")
d = D("d")
g = E("g")

f.y = l
i.p = f
i.r = f
i.z = g
i.u = g
i.q = g
l.q = d
l.y = d
d.s = f
d.p = f
d.t = g
d.y = i
d.o = l
g.x = l
g.r = l
g.v = l
g.w = f
g.s = f
assert f.y.q.y.txt == "i"