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

class B:
    def __init__(self, txt: str):
        self.u: D = None
        self.z: E = None
        self.x: D = None
        self.t: G = None
        self.w: A = None
        self.s: C = None
        self.txt = txt

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

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

class E:
    def __init__(self, txt: str):
        self.u: G = None
        self.r: G = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.o: A = None
        self.x: B = None
        self.z: A = None
        self.p: D = None
        self.txt = txt

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

j = A("j")
f = B("f")
m = C("m")
c = D("c")
i = E("i")
g = F("g")
n = G("n")
a = B("a")

j.x = g
j.y = m
f.u = c
f.x = c
f.z = i
f.t = n
f.w = j
f.s = m
m.x = c
c.x = m
i.u = n
i.r = n
g.o = j
g.z = j
g.x = f
g.p = c
n.y = m
n.t = i
a.u = c
a.x = c
a.z = i
a.t = n
a.w = j
a.s = m
assert c.x.x.x.x.x.x.x.x.txt == "
class A:
    def __init__(self, txt: str):
        self.x: F = None
        self.y: C = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.u: D = None
        self.z: E = None
        self.x: D = None
        self.t: G = None
        self.w: A = None
        self.s: C = None
        self.txt = txt

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

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

class E:
    def __init__(self, txt: str):
        self.u: G = None
        self.r: G = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.o: A = None
        self.x: B = None
        self.z: A = None
        self.p: D = None
        self.txt = txt

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

j = A("j")
f = B("f")
m = C("m")
c = D("c")
i = E("i")
g = F("g")
n = G("n")
a = B("a")

j.x = g
j.y = m
f.u = c
f.x = c
f.z = i
f.t = n
f.w = j
f.s = m
m.x = c
c.x = m
i.u = n
i.r = n
g.o = j
g.z = j
g.x = f
g.p = c
n.y = m
n.t = i
a.u = c
a.x = c
a.z = i
a.t = n
a.w = j
a.s = m
assert c.x.x.x.x.x.x.x.x.txt == "c"