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

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

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

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

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

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

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

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

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

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

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

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

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

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

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