class A:
    def __init__(self, txt: str):
        self.o: C = None
        self.u: F = None
        self.v: C = None
        self.q: C = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.o: D = None
        self.txt = txt

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

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

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

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

a = A("a")
e = B("e")
b = C("b")
n = D("n")
m = E("m")
f = F("f")

a.o = b
a.v = b
a.q = b
a.u = f
e.o = n
b.t = a
b.q = e
b.u = e
n.x = b
n.q = b
n.p = a
n.t = f
m.u = a
m.o = a
m.z = b
m.y = f
m.s = e
f.q = n
f.z = a
f.u = m
f.t = m
f.s = m
f.p = e
assert b.t.o.t.u.q.t.txt == "
class A:
    def __init__(self, txt: str):
        self.o: C = None
        self.u: F = None
        self.v: C = None
        self.q: C = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.o: D = None
        self.txt = txt

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

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

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

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

a = A("a")
e = B("e")
b = C("b")
n = D("n")
m = E("m")
f = F("f")

a.o = b
a.v = b
a.q = b
a.u = f
e.o = n
b.t = a
b.q = e
b.u = e
n.x = b
n.q = b
n.p = a
n.t = f
m.u = a
m.o = a
m.z = b
m.y = f
m.s = e
f.q = n
f.z = a
f.u = m
f.t = m
f.s = m
f.p = e
assert b.t.o.t.u.q.t.txt == "f"