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

class B:
    def __init__(self, txt: str):
        self.x: A = None
        self.txt = txt

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

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

class E:
    def __init__(self, txt: str):
        self.r: B = None
        self.p: B = None
        self.q: C = None
        self.v: D = None
        self.txt = txt

i = A("i")
n = B("n")
f = C("f")
a = D("a")
l = E("l")
d = A("d")
e = C("e")

i.x = f
i.p = a
i.o = a
i.y = e
i.r = d
n.x = i
f.w = l
f.y = n
f.r = e
f.z = d
a.o = e
l.r = n
l.p = n
l.q = f
l.v = a
d.x = f
d.y = f
d.p = a
d.o = a
d.r = i
e.w = l
e.y = n
e.r = f
e.z = d
assert d.r.y.w.q.r.txt == "
class A:
    def __init__(self, txt: str):
        self.x: C = None
        self.p: D = None
        self.y: C = None
        self.r: A = None
        self.o: D = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.x: A = None
        self.txt = txt

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

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

class E:
    def __init__(self, txt: str):
        self.r: B = None
        self.p: B = None
        self.q: C = None
        self.v: D = None
        self.txt = txt

i = A("i")
n = B("n")
f = C("f")
a = D("a")
l = E("l")
d = A("d")
e = C("e")

i.x = f
i.p = a
i.o = a
i.y = e
i.r = d
n.x = i
f.w = l
f.y = n
f.r = e
f.z = d
a.o = e
l.r = n
l.p = n
l.q = f
l.v = a
d.x = f
d.y = f
d.p = a
d.o = a
d.r = i
e.w = l
e.y = n
e.r = f
e.z = d
assert d.r.y.w.q.r.txt == "e"