class A:
    def __init__(self, txt: str):
        self.y: B = None
        self.o: D = None
        self.q: D = None
        self.r: D = None
        self.w: B = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.r: C = None
        self.y: A = None
        self.z: D = None
        self.s: A = None
        self.v: D = None
        self.t: F = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.y: A = None
        self.w: C = None
        self.v: E = None
        self.p: B = None
        self.x: B = None
        self.txt = txt

f = A("f")
g = B("g")
m = C("m")
i = D("i")
e = E("e")
l = F("l")

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

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

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

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

class E:
    def __init__(self, txt: str):
        self.r: C = None
        self.y: A = None
        self.z: D = None
        self.s: A = None
        self.v: D = None
        self.t: F = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.y: A = None
        self.w: C = None
        self.v: E = None
        self.p: B = None
        self.x: B = None
        self.txt = txt

f = A("f")
g = B("g")
m = C("m")
i = D("i")
e = E("e")
l = F("l")

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