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

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

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

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

class E:
    def __init__(self, txt: str):
        self.w: A = None
        self.q: C = None
        self.y: A = None
        self.t: A = None
        self.s: B = None
        self.txt = txt

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

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

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

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

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

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

class E:
    def __init__(self, txt: str):
        self.w: A = None
        self.q: C = None
        self.y: A = None
        self.t: A = None
        self.s: B = None
        self.txt = txt

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

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

k.y = m
l.s = i
l.t = f
l.y = e
l.x = g
h.q = i
h.t = k
h.s = n
h.v = g
g.o = f
g.t = l
g.z = h
f.w = k
f.y = k
f.t = k
f.q = c
f.s = e
i.q = c
i.r = c
i.x = l
m.q = c
m.x = l
m.r = h
n.o = f
n.t = l
n.z = h
c.q = i
c.t = k
c.s = g
c.v = g
e.s = m
e.t = f
e.y = l
e.x = g
assert m.x.s.x.s.r.t.y.r.txt == "h"