class A:
    def __init__(self, txt: str):
        self.z: D = None
        self.x: A = None
        self.t: D = None
        self.w: A = None
        self.txt = txt

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

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

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

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

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

f.z = l
f.t = l
f.x = n
f.w = n
e.z = f
a.t = n
l.x = m
l.o = m
m.q = e
m.y = l
n.z = l
n.t = l
n.x = f
n.w = f
assert e.z.w.z.txt == "
class A:
    def __init__(self, txt: str):
        self.z: D = None
        self.x: A = None
        self.t: D = None
        self.w: A = None
        self.txt = txt

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

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

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

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

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

f.z = l
f.t = l
f.x = n
f.w = n
e.z = f
a.t = n
l.x = m
l.o = m
m.q = e
m.y = l
n.z = l
n.t = l
n.x = f
n.w = f
assert e.z.w.z.txt == "l"