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

class B:
    def __init__(self, txt: str):
        self.w: A = None
        self.t: D = None
        self.u: D = None
        self.v: D = None
        self.q: D = None
        self.z: A = None
        self.txt = txt

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

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

class E:
    def __init__(self, txt: str):
        self.t: B = None
        self.o: C = None
        self.y: C = None
        self.x: F = None
        self.r: F = None
        self.txt = txt

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

d = A("d")
h = B("h")
l = C("l")
g = D("g")
k = E("k")
m = F("m")
a = E("a")
i = E("i")

d.w = g
h.w = d
h.z = d
h.t = g
h.u = g
h.v = g
h.q = g
l.v = k
l.o = a
l.t = a
l.p = g
l.z = h
g.w = m
k.t = h
k.o = l
k.y = l
k.x = m
k.r = m
m.u = d
a.t = h
a.o = l
a.y = l
a.x = m
a.r = m
i.t = h
i.o = l
i.y = l
i.x = m
i.r = m
assert a.t.u.w.u.w.w.txt == "
class A:
    def __init__(self, txt: str):
        self.w: D = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.w: A = None
        self.t: D = None
        self.u: D = None
        self.v: D = None
        self.q: D = None
        self.z: A = None
        self.txt = txt

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

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

class E:
    def __init__(self, txt: str):
        self.t: B = None
        self.o: C = None
        self.y: C = None
        self.x: F = None
        self.r: F = None
        self.txt = txt

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

d = A("d")
h = B("h")
l = C("l")
g = D("g")
k = E("k")
m = F("m")
a = E("a")
i = E("i")

d.w = g
h.w = d
h.z = d
h.t = g
h.u = g
h.v = g
h.q = g
l.v = k
l.o = a
l.t = a
l.p = g
l.z = h
g.w = m
k.t = h
k.o = l
k.y = l
k.x = m
k.r = m
m.u = d
a.t = h
a.o = l
a.y = l
a.x = m
a.r = m
i.t = h
i.o = l
i.y = l
i.x = m
i.r = m
assert a.t.u.w.u.w.w.txt == "m"