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

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

class C:
    def __init__(self, txt: str):
        self.t: D = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.t: E = None
        self.x: B = None
        self.p: C = None
        self.u: B = None
        self.v: A = 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.p: C = None
        self.x: A = None
        self.s: E = None
        self.v: E = None
        self.z: A = None
        self.w: E = None
        self.txt = txt

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

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

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

class C:
    def __init__(self, txt: str):
        self.t: D = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.t: E = None
        self.x: B = None
        self.p: C = None
        self.u: B = None
        self.v: A = 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.p: C = None
        self.x: A = None
        self.s: E = None
        self.v: E = None
        self.z: A = None
        self.w: E = None
        self.txt = txt

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

k.w = d
m.o = d
n.t = l
d.t = j
d.x = m
d.u = m
d.p = n
d.v = h
b.p = k
a.p = n
a.x = h
a.s = b
a.v = b
a.z = k
a.w = j
j.p = k
h.w = l
l.t = j
l.x = m
l.u = m
l.p = n
l.v = k
c.p = k
assert l.v.w.t.p.w.x.o.p.txt == "n"