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

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

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

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

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

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

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

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

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

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

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

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

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

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

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