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

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

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

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

class E:
    def __init__(self, txt: str):
        self.u: B = None
        self.t: C = None
        self.z: F = None
        self.s: B = None
        self.w: F = None
        self.o: F = None
        self.txt = txt

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

k = A("k")
g = B("g")
c = C("c")
b = D("b")
e = E("e")
m = F("m")

k.t = b
k.s = e
g.z = b
g.s = m
c.s = m
b.w = m
b.r = g
b.p = c
e.u = g
e.s = g
e.t = c
e.z = m
e.w = m
e.o = m
m.t = g
assert k.s.u.s.t.z.txt == "
class A:
    def __init__(self, txt: str):
        self.t: D = None
        self.s: E = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.u: B = None
        self.t: C = None
        self.z: F = None
        self.s: B = None
        self.w: F = None
        self.o: F = None
        self.txt = txt

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

k = A("k")
g = B("g")
c = C("c")
b = D("b")
e = E("e")
m = F("m")

k.t = b
k.s = e
g.z = b
g.s = m
c.s = m
b.w = m
b.r = g
b.p = c
e.u = g
e.s = g
e.t = c
e.z = m
e.w = m
e.o = m
m.t = g
assert k.s.u.s.t.z.txt == "b"