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

class B:
    def __init__(self, txt: str):
        self.s: D = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.x: B = None
        self.v: A = None
        self.q: B = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.v: D = None
        self.r: D = None
        self.q: E = None
        self.x: A = None
        self.txt = txt

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

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

h.q = k
e.s = k
m.t = n
m.w = n
m.r = h
m.o = i
m.y = i
k.x = e
k.v = h
k.q = g
j.v = i
j.r = k
j.q = l
j.x = h
n.p = j
n.u = h
g.s = i
l.v = k
l.r = k
l.q = j
l.x = h
i.x = e
i.q = e
i.v = h
assert j.r.v.q.v.q.q.txt == "
class A:
    def __init__(self, txt: str):
        self.q: D = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.s: D = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.x: B = None
        self.v: A = None
        self.q: B = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.v: D = None
        self.r: D = None
        self.q: E = None
        self.x: A = None
        self.txt = txt

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

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

h.q = k
e.s = k
m.t = n
m.w = n
m.r = h
m.o = i
m.y = i
k.x = e
k.v = h
k.q = g
j.v = i
j.r = k
j.q = l
j.x = h
n.p = j
n.u = h
g.s = i
l.v = k
l.r = k
l.q = j
l.x = h
i.x = e
i.q = e
i.v = h
assert j.r.v.q.v.q.q.txt == "g"