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

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

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

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

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

m = A("m")
b = B("b")
j = C("j")
l = D("l")
i = E("i")
g = E("g")
c = D("c")
e = E("e")
f = A("f")

m.w = f
b.z = j
b.x = l
b.y = f
j.y = b
l.r = g
i.y = b
i.w = e
i.x = c
g.y = b
g.w = i
g.x = l
c.r = g
e.y = b
e.w = g
e.x = c
f.w = m
assert i.w.w.w.y.y.txt == "
class A:
    def __init__(self, txt: str):
        self.w: A = None
        self.txt = txt

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

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

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

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

m = A("m")
b = B("b")
j = C("j")
l = D("l")
i = E("i")
g = E("g")
c = D("c")
e = E("e")
f = A("f")

m.w = f
b.z = j
b.x = l
b.y = f
j.y = b
l.r = g
i.y = b
i.w = e
i.x = c
g.y = b
g.w = i
g.x = l
c.r = g
e.y = b
e.w = g
e.x = c
f.w = m
assert i.w.w.w.y.y.txt == "f"