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

class B:
    def __init__(self, txt: str):
        self.u: D = None
        self.r: D = None
        self.z: E = None
        self.o: E = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.z: E = None
        self.u: A = None
        self.y: A = None
        self.x: E = None
        self.q: A = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.t: A = None
        self.v: E = None
        self.r: B = None
        self.w: C = None
        self.s: D = None
        self.txt = txt

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

k.z = g
a.u = b
a.r = b
a.z = j
a.o = j
g.z = j
g.s = b
b.z = j
b.x = j
b.u = k
b.q = k
b.y = n
j.z = b
l.t = n
l.v = j
l.r = a
l.w = g
l.s = b
n.z = g
d.z = g
assert l.w.s.y.z.txt == "
class A:
    def __init__(self, txt: str):
        self.z: C = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.u: D = None
        self.r: D = None
        self.z: E = None
        self.o: E = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.z: E = None
        self.u: A = None
        self.y: A = None
        self.x: E = None
        self.q: A = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.t: A = None
        self.v: E = None
        self.r: B = None
        self.w: C = None
        self.s: D = None
        self.txt = txt

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

k.z = g
a.u = b
a.r = b
a.z = j
a.o = j
g.z = j
g.s = b
b.z = j
b.x = j
b.u = k
b.q = k
b.y = n
j.z = b
l.t = n
l.v = j
l.r = a
l.w = g
l.s = b
n.z = g
d.z = g
assert l.w.s.y.z.txt == "g"