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

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

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

class D:
    def __init__(self, txt: str):
        self.x: F = None
        self.s: C = None
        self.p: A = None
        self.u: E = None
        self.txt = txt

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

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

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

m.o = k
m.t = g
i.z = l
i.y = m
i.s = a
i.x = k
i.q = k
g.r = l
a.x = b
a.s = g
a.p = m
a.u = f
f.w = i
f.o = i
f.p = m
f.x = g
b.s = f
b.x = f
b.o = m
k.z = g
k.y = m
k.s = a
k.x = i
k.q = i
l.r = g
assert g.r.r.r.r.r.r.txt == "
class A:
    def __init__(self, txt: str):
        self.o: B = None
        self.t: C = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.x: F = None
        self.s: C = None
        self.p: A = None
        self.u: E = None
        self.txt = txt

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

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

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

m.o = k
m.t = g
i.z = l
i.y = m
i.s = a
i.x = k
i.q = k
g.r = l
a.x = b
a.s = g
a.p = m
a.u = f
f.w = i
f.o = i
f.p = m
f.x = g
b.s = f
b.x = f
b.o = m
k.z = g
k.y = m
k.s = a
k.x = i
k.q = i
l.r = g
assert g.r.r.r.r.r.r.txt == "g"