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

class B:
    def __init__(self, txt: str):
        self.y: D = None
        self.z: E = None
        self.x: E = None
        self.o: C = None
        self.t: A = None
        self.r: C = None
        self.txt = txt

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

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

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

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

a = A("a")
g = B("g")
d = C("d")
f = D("f")
l = E("l")
m = F("m")
k = D("k")

a.z = k
g.y = k
g.z = l
g.x = l
g.o = d
g.r = d
g.t = a
d.u = m
f.x = a
f.r = a
f.y = d
f.t = d
f.s = m
f.w = k
l.x = f
m.x = g
k.x = a
k.r = a
k.y = d
k.t = d
k.s = m
k.w = f
assert k.y.u.x.y.txt == "
class A:
    def __init__(self, txt: str):
        self.z: D = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.y: D = None
        self.z: E = None
        self.x: E = None
        self.o: C = None
        self.t: A = None
        self.r: C = None
        self.txt = txt

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

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

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

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

a = A("a")
g = B("g")
d = C("d")
f = D("f")
l = E("l")
m = F("m")
k = D("k")

a.z = k
g.y = k
g.z = l
g.x = l
g.o = d
g.r = d
g.t = a
d.u = m
f.x = a
f.r = a
f.y = d
f.t = d
f.s = m
f.w = k
l.x = f
m.x = g
k.x = a
k.r = a
k.y = d
k.t = d
k.s = m
k.w = f
assert k.y.u.x.y.txt == "k"