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

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

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

class D:
    def __init__(self, txt: str):
        self.z: F = None
        self.t: C = None
        self.s: B = None
        self.u: C = None
        self.txt = txt

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

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

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

g.x = k
d.w = e
d.u = e
d.r = c
d.s = c
d.o = g
d.p = k
n.u = k
n.q = c
n.x = g
i.z = k
i.t = e
i.s = d
i.u = n
c.s = n
k.q = d
k.s = d
k.p = c
k.y = i
k.t = i
e.u = k
e.q = c
e.x = g
assert e.q.s.q.s.q.s.txt == "
class A:
    def __init__(self, txt: str):
        self.x: F = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.z: F = None
        self.t: C = None
        self.s: B = None
        self.u: C = None
        self.txt = txt

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

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

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

g.x = k
d.w = e
d.u = e
d.r = c
d.s = c
d.o = g
d.p = k
n.u = k
n.q = c
n.x = g
i.z = k
i.t = e
i.s = d
i.u = n
c.s = n
k.q = d
k.s = d
k.p = c
k.y = i
k.t = i
e.u = k
e.q = c
e.x = g
assert e.q.s.q.s.q.s.txt == "n"