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

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

class C:
    def __init__(self, txt: str):
        self.p: B = None
        self.x: E = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.s: C = None
        self.x: C = None
        self.o: F = None
        self.q: B = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.p: F = None
        self.q: D = None
        self.z: C = None
        self.r: B = None
        self.u: F = None
        self.txt = txt

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

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

f.q = l
f.w = a
f.p = c
i.w = c
i.s = l
i.o = f
i.y = e
c.p = i
c.x = e
a.s = c
a.x = c
a.o = l
a.q = i
e.p = l
e.u = l
e.q = a
e.z = c
e.r = i
l.q = f
l.w = f
assert e.u.w.p.txt == "
class A:
    def __init__(self, txt: str):
        self.q: F = None
        self.w: D = None
        self.p: C = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.p: B = None
        self.x: E = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.s: C = None
        self.x: C = None
        self.o: F = None
        self.q: B = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.p: F = None
        self.q: D = None
        self.z: C = None
        self.r: B = None
        self.u: F = None
        self.txt = txt

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

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

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