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

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

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

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

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

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

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

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

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

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

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

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

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

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

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