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

class B:
    def __init__(self, txt: str):
        self.p: E = None
        self.z: A = None
        self.txt = txt

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

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

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

class F:
    def __init__(self, txt: str):
        self.w: B = None
        self.y: A = None
        self.t: C = None
        self.x: B = None
        self.u: D = None
        self.q: A = None
        self.txt = txt

d = A("d")
k = B("k")
n = C("n")
g = D("g")
b = E("b")
l = F("l")
m = A("m")

d.y = l
d.t = n
d.z = m
k.p = b
k.z = d
n.u = m
g.v = l
b.p = m
b.y = d
l.w = k
l.x = k
l.y = m
l.q = m
l.t = n
l.u = g
m.y = l
m.t = n
m.z = d
assert l.u.v.y.z.t.txt == "
class A:
    def __init__(self, txt: str):
        self.y: F = None
        self.t: C = None
        self.z: A = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.p: E = None
        self.z: A = None
        self.txt = txt

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

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

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

class F:
    def __init__(self, txt: str):
        self.w: B = None
        self.y: A = None
        self.t: C = None
        self.x: B = None
        self.u: D = None
        self.q: A = None
        self.txt = txt

d = A("d")
k = B("k")
n = C("n")
g = D("g")
b = E("b")
l = F("l")
m = A("m")

d.y = l
d.t = n
d.z = m
k.p = b
k.z = d
n.u = m
g.v = l
b.p = m
b.y = d
l.w = k
l.x = k
l.y = m
l.q = m
l.t = n
l.u = g
m.y = l
m.t = n
m.z = d
assert l.u.v.y.z.t.txt == "n"