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

class B:
    def __init__(self, txt: str):
        self.s: C = None
        self.q: A = None
        self.p: C = None
        self.x: B = None
        self.u: C = None
        self.z: C = None
        self.txt = txt

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

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

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

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

m = A("m")
e = B("e")
h = C("h")
i = D("i")
d = E("d")
n = F("n")
k = D("k")
f = A("f")
g = B("g")

m.w = k
m.q = g
e.s = h
e.p = h
e.u = h
e.z = h
e.q = f
e.x = g
h.v = e
h.p = g
h.u = k
h.s = k
h.z = m
i.y = d
d.q = f
d.r = n
n.z = d
n.r = h
n.w = h
k.y = d
f.w = i
f.q = g
g.s = h
g.p = h
g.u = h
g.z = h
g.q = f
g.x = e
assert d.r.z.q.w.y.q.q.q.txt == "
class A:
    def __init__(self, txt: str):
        self.w: D = None
        self.q: B = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.s: C = None
        self.q: A = None
        self.p: C = None
        self.x: B = None
        self.u: C = None
        self.z: C = None
        self.txt = txt

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

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

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

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

m = A("m")
e = B("e")
h = C("h")
i = D("i")
d = E("d")
n = F("n")
k = D("k")
f = A("f")
g = B("g")

m.w = k
m.q = g
e.s = h
e.p = h
e.u = h
e.z = h
e.q = f
e.x = g
h.v = e
h.p = g
h.u = k
h.s = k
h.z = m
i.y = d
d.q = f
d.r = n
n.z = d
n.r = h
n.w = h
k.y = d
f.w = i
f.q = g
g.s = h
g.p = h
g.u = h
g.z = h
g.q = f
g.x = e
assert d.r.z.q.w.y.q.q.q.txt == "f"