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

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

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

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

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

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

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

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

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

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

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

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

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

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

f.y = c
f.x = g
j.t = n
j.r = i
e.o = g
e.v = c
e.x = m
m.q = e
i.t = n
g.p = i
g.o = i
g.t = m
g.s = j
a.t = f
a.r = i
n.y = c
n.x = g
c.o = g
c.v = e
c.x = m
assert m.q.o.t.q.o.t.q.o.txt == "g"