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

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

class C:
    def __init__(self, txt: str):
        self.z: A = None
        self.y: E = None
        self.p: D = None
        self.s: E = None
        self.t: E = None
        self.txt = txt

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

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

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

m = A("m")
l = B("l")
n = C("n")
j = D("j")
i = E("i")
a = F("a")
g = B("g")
k = A("k")

m.o = n
l.w = a
n.z = k
n.y = i
n.s = i
n.t = i
n.p = j
j.y = n
i.w = n
a.z = n
g.w = a
k.o = n
assert n.t.w.y.w.txt == "
class A:
    def __init__(self, txt: str):
        self.o: C = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.z: A = None
        self.y: E = None
        self.p: D = None
        self.s: E = None
        self.t: E = None
        self.txt = txt

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

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

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

m = A("m")
l = B("l")
n = C("n")
j = D("j")
i = E("i")
a = F("a")
g = B("g")
k = A("k")

m.o = n
l.w = a
n.z = k
n.y = i
n.s = i
n.t = i
n.p = j
j.y = n
i.w = n
a.z = n
g.w = a
k.o = n
assert n.t.w.y.w.txt == "n"