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

class B:
    def __init__(self, txt: str):
        self.r: C = None
        self.txt = txt

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

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

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

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

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

f.t = n
f.x = k
m.r = h
h.z = m
h.w = d
h.u = d
i.r = f
i.x = f
i.o = d
i.w = k
i.u = k
i.p = h
d.y = f
n.p = m
n.u = m
n.z = k
n.x = k
n.v = f
n.w = d
k.p = m
k.u = m
k.z = n
k.x = n
k.v = f
k.w = d
assert h.w.y.x.z.txt == "
class A:
    def __init__(self, txt: str):
        self.t: F = None
        self.x: F = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.r: C = None
        self.txt = txt

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

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

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

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

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

f.t = n
f.x = k
m.r = h
h.z = m
h.w = d
h.u = d
i.r = f
i.x = f
i.o = d
i.w = k
i.u = k
i.p = h
d.y = f
n.p = m
n.u = m
n.z = k
n.x = k
n.v = f
n.w = d
k.p = m
k.u = m
k.z = n
k.x = n
k.v = f
k.w = d
assert h.w.y.x.z.txt == "n"