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

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

class C:
    def __init__(self, txt: str):
        self.p: C = None
        self.o: A = None
        self.w: A = None
        self.s: C = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.s: B = None
        self.y: B = None
        self.z: B = None
        self.txt = txt

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

h = A("h")
l = B("l")
k = C("k")
b = D("b")
a = E("a")
m = F("m")
g = C("g")
n = A("n")
d = B("d")
c = D("c")

h.o = g
h.s = n
h.v = m
l.v = d
l.r = d
l.q = d
l.p = m
k.p = g
k.s = g
k.o = h
k.w = h
b.p = d
b.w = l
a.s = d
a.y = d
a.z = l
m.o = b
m.y = h
g.p = k
g.s = k
g.o = h
g.w = n
n.o = k
n.s = h
n.v = m
d.v = l
d.r = l
d.q = l
d.p = m
c.p = l
c.w = l
assert l.q.p.y.v.y.v.y.v.txt == "
class A:
    def __init__(self, txt: str):
        self.o: C = None
        self.s: A = None
        self.v: F = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.p: C = None
        self.o: A = None
        self.w: A = None
        self.s: C = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.s: B = None
        self.y: B = None
        self.z: B = None
        self.txt = txt

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

h = A("h")
l = B("l")
k = C("k")
b = D("b")
a = E("a")
m = F("m")
g = C("g")
n = A("n")
d = B("d")
c = D("c")

h.o = g
h.s = n
h.v = m
l.v = d
l.r = d
l.q = d
l.p = m
k.p = g
k.s = g
k.o = h
k.w = h
b.p = d
b.w = l
a.s = d
a.y = d
a.z = l
m.o = b
m.y = h
g.p = k
g.s = k
g.o = h
g.w = n
n.o = k
n.s = h
n.v = m
d.v = l
d.r = l
d.q = l
d.p = m
c.p = l
c.w = l
assert l.q.p.y.v.y.v.y.v.txt == "m"