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

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

class C:
    def __init__(self, txt: str):
        self.r: D = None
        self.w: C = None
        self.y: B = None
        self.p: F = None
        self.t: D = None
        self.o: C = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.o: E = None
        self.txt = txt

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

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

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

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

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

class C:
    def __init__(self, txt: str):
        self.r: D = None
        self.w: C = None
        self.y: B = None
        self.p: F = None
        self.t: D = None
        self.o: C = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.o: E = None
        self.txt = txt

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

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

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

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