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

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

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

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

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

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

k = A("k")
a = B("a")
g = C("g")
l = D("l")
m = E("m")
j = F("j")
i = E("i")

k.q = a
k.o = g
a.o = k
g.w = k
g.v = l
g.s = a
g.z = j
l.q = i
m.r = l
m.o = a
m.q = j
j.q = l
j.s = g
j.y = k
i.r = l
i.o = a
i.q = j
assert i.q.q.q.o.txt == "
class A:
    def __init__(self, txt: str):
        self.q: B = None
        self.o: C = None
        self.txt = txt

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

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

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

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

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

k = A("k")
a = B("a")
g = C("g")
l = D("l")
m = E("m")
j = F("j")
i = E("i")

k.q = a
k.o = g
a.o = k
g.w = k
g.v = l
g.s = a
g.z = j
l.q = i
m.r = l
m.o = a
m.q = j
j.q = l
j.s = g
j.y = k
i.r = l
i.o = a
i.q = j
assert i.q.q.q.o.txt == "a"