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

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

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

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

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

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

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

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

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

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

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

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

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

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

h.t = m
h.u = m
h.q = g
h.w = g
g.y = n
g.w = h
b.v = n
b.r = m
i.p = d
i.w = b
i.s = b
i.r = g
i.u = h
i.z = n
m.q = g
m.w = g
d.s = g
d.p = b
n.p = d
n.w = b
n.s = b
n.r = g
n.u = h
n.z = i
assert g.y.u.t.q.w.txt == "h"