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

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

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

class D:
    def __init__(self, txt: str):
        self.t: F = None
        self.v: E = None
        self.y: E = None
        self.r: B = None
        self.txt = txt

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

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

j = A("j")
e = B("e")
n = C("n")
i = D("i")
c = E("c")
g = F("g")
h = A("h")
k = E("k")

j.o = g
j.q = g
j.s = g
j.z = k
e.r = n
e.q = g
n.r = g
i.t = g
i.v = k
i.y = c
i.r = e
c.u = h
g.q = e
h.o = g
h.q = g
h.s = g
h.z = c
k.u = j
assert j.s.q.q.q.q.q.txt == "
class A:
    def __init__(self, txt: str):
        self.o: F = None
        self.z: E = None
        self.q: F = None
        self.s: F = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.t: F = None
        self.v: E = None
        self.y: E = None
        self.r: B = None
        self.txt = txt

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

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

j = A("j")
e = B("e")
n = C("n")
i = D("i")
c = E("c")
g = F("g")
h = A("h")
k = E("k")

j.o = g
j.q = g
j.s = g
j.z = k
e.r = n
e.q = g
n.r = g
i.t = g
i.v = k
i.y = c
i.r = e
c.u = h
g.q = e
h.o = g
h.q = g
h.s = g
h.z = c
k.u = j
assert j.s.q.q.q.q.q.txt == "e"