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

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

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

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

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

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

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

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

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

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

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

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

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

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

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