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

class B:
    def __init__(self, txt: str):
        self.s: C = None
        self.u: A = None
        self.p: A = None
        self.y: B = None
        self.o: A = None
        self.r: D = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.q: E = None
        self.x: A = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.p: C = None
        self.r: C = None
        self.z: C = None
        self.q: A = None
        self.w: F = None
        self.s: D = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.r: A = None
        self.txt = txt

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

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

class B:
    def __init__(self, txt: str):
        self.s: C = None
        self.u: A = None
        self.p: A = None
        self.y: B = None
        self.o: A = None
        self.r: D = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.q: E = None
        self.x: A = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.p: C = None
        self.r: C = None
        self.z: C = None
        self.q: A = None
        self.w: F = None
        self.s: D = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.r: A = None
        self.txt = txt

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

k.y = a
k.r = d
f.s = n
f.u = a
f.p = a
f.o = a
f.y = m
f.r = d
n.q = g
n.x = k
d.y = k
d.z = c
g.p = n
g.r = n
g.z = n
g.q = a
g.w = c
g.s = d
c.r = a
m.s = n
m.u = a
m.o = a
m.p = k
m.y = f
m.r = d
a.y = k
a.r = d
assert f.r.z.r.y.r.y.txt == "k"