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

class B:
    def __init__(self, txt: str):
        self.o: B = None
        self.s: B = None
        self.txt = txt

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

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

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

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

j = A("j")
n = B("n")
d = C("d")
e = D("e")
b = E("b")
c = F("c")
k = C("k")
m = B("m")

j.v = e
n.o = m
n.s = m
d.v = m
d.r = e
d.q = n
e.w = j
b.v = k
b.p = m
b.z = j
c.r = j
c.o = j
c.y = j
k.v = n
k.r = e
k.q = m
m.o = n
m.s = n
assert k.q.s.o.o.o.s.o.o.txt == "
class A:
    def __init__(self, txt: str):
        self.v: D = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.o: B = None
        self.s: B = None
        self.txt = txt

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

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

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

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

j = A("j")
n = B("n")
d = C("d")
e = D("e")
b = E("b")
c = F("c")
k = C("k")
m = B("m")

j.v = e
n.o = m
n.s = m
d.v = m
d.r = e
d.q = n
e.w = j
b.v = k
b.p = m
b.z = j
c.r = j
c.o = j
c.y = j
k.v = n
k.r = e
k.q = m
m.o = n
m.s = n
assert k.q.s.o.o.o.s.o.o.txt == "n"