class A:
    def __init__(self, txt: str):
        self.z: C = None
        self.s: C = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.z: C = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.x: B = None
        self.s: C = None
        self.u: D = None
        self.t: C = None
        self.w: B = None
        self.txt = txt

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

a = A("a")
f = B("f")
g = C("g")
j = D("j")
i = E("i")
m = F("m")
h = A("h")

a.z = g
a.s = g
f.t = h
f.y = j
g.v = f
g.w = j
j.z = g
i.x = f
i.w = f
i.s = g
i.t = g
i.u = j
m.q = f
m.w = i
h.z = g
h.s = g
assert m.w.x.y.txt == "
class A:
    def __init__(self, txt: str):
        self.z: C = None
        self.s: C = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.z: C = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.x: B = None
        self.s: C = None
        self.u: D = None
        self.t: C = None
        self.w: B = None
        self.txt = txt

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

a = A("a")
f = B("f")
g = C("g")
j = D("j")
i = E("i")
m = F("m")
h = A("h")

a.z = g
a.s = g
f.t = h
f.y = j
g.v = f
g.w = j
j.z = g
i.x = f
i.w = f
i.s = g
i.t = g
i.u = j
m.q = f
m.w = i
h.z = g
h.s = g
assert m.w.x.y.txt == "j"