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

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

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

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

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

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

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

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

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

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

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

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

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

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

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