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

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

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

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

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

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

a = A("a")
e = B("e")
j = C("j")
f = D("f")
k = E("k")
i = F("i")

a.u = j
a.q = i
e.t = f
e.u = f
e.p = i
e.w = k
j.q = a
f.z = j
f.u = e
f.q = k
f.y = k
f.t = i
k.o = j
k.t = i
i.r = a
i.t = a
assert k.t.t.u.q.u.q.txt == "
class A:
    def __init__(self, txt: str):
        self.u: C = None
        self.q: F = None
        self.txt = txt

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

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

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

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

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

a = A("a")
e = B("e")
j = C("j")
f = D("f")
k = E("k")
i = F("i")

a.u = j
a.q = i
e.t = f
e.u = f
e.p = i
e.w = k
j.q = a
f.z = j
f.u = e
f.q = k
f.y = k
f.t = i
k.o = j
k.t = i
i.r = a
i.t = a
assert k.t.t.u.q.u.q.txt == "a"