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

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

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

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

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

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

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

k.w = i
i.t = l
g.u = c
g.t = c
g.y = l
l.q = i
l.t = i
l.p = f
n.p = f
n.z = h
f.u = k
f.x = l
f.p = h
f.w = n
b.p = f
b.z = h
d.u = n
d.y = l
d.t = b
h.u = n
h.y = l
h.t = b
c.p = f
c.z = h
assert f.p.u.z.u.z.y.p.w.txt == "
class A:
    def __init__(self, txt: str):
        self.w: B = None
        self.txt = txt

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

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

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

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

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

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

k.w = i
i.t = l
g.u = c
g.t = c
g.y = l
l.q = i
l.t = i
l.p = f
n.p = f
n.z = h
f.u = k
f.x = l
f.p = h
f.w = n
b.p = f
b.z = h
d.u = n
d.y = l
d.t = b
h.u = n
h.y = l
h.t = b
c.p = f
c.z = h
assert f.p.u.z.u.z.y.p.w.txt == "n"