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

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.u: D = None
        self.v: D = None
        self.p: A = None
        self.x: A = None
        self.o: B = None
        self.txt = txt

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

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

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.u: D = None
        self.v: D = None
        self.p: A = None
        self.x: A = None
        self.o: B = None
        self.txt = txt

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

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