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

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

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

a = A("a")
i = B("i")
m = C("m")
n = B("n")
g = A("g")
e = A("e")
d = B("d")
f = A("f")
l = B("l")

a.y = e
a.w = f
i.u = d
i.z = m
m.r = e
m.t = n
m.x = f
n.u = i
n.z = m
g.y = f
g.w = a
e.y = f
e.w = g
d.u = i
d.z = m
f.y = a
f.w = a
l.u = n
l.z = m
assert f.y.y.w.y.txt == "
class A:
    def __init__(self, txt: str):
        self.y: A = None
        self.w: A = None
        self.txt = txt

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

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

a = A("a")
i = B("i")
m = C("m")
n = B("n")
g = A("g")
e = A("e")
d = B("d")
f = A("f")
l = B("l")

a.y = e
a.w = f
i.u = d
i.z = m
m.r = e
m.t = n
m.x = f
n.u = i
n.z = m
g.y = f
g.w = a
e.y = f
e.w = g
d.u = i
d.z = m
f.y = a
f.w = a
l.u = n
l.z = m
assert f.y.y.w.y.txt == "f"