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

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

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

class D:
    def __init__(self, txt: str):
        self.u: B = None
        self.v: F = None
        self.w: A = None
        self.q: A = None
        self.o: C = None
        self.txt = txt

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

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

m = A("m")
b = B("b")
k = C("k")
a = D("a")
h = E("h")
c = F("c")

m.t = c
m.s = c
m.w = a
b.t = m
b.r = a
b.o = c
k.y = b
a.u = b
a.v = c
a.w = m
a.q = m
a.o = k
h.u = k
c.u = h
assert k.y.r.q.w.o.txt == "
class A:
    def __init__(self, txt: str):
        self.t: F = None
        self.w: D = None
        self.s: F = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.u: B = None
        self.v: F = None
        self.w: A = None
        self.q: A = None
        self.o: C = None
        self.txt = txt

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

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

m = A("m")
b = B("b")
k = C("k")
a = D("a")
h = E("h")
c = F("c")

m.t = c
m.s = c
m.w = a
b.t = m
b.r = a
b.o = c
k.y = b
a.u = b
a.v = c
a.w = m
a.q = m
a.o = k
h.u = k
c.u = h
assert k.y.r.q.w.o.txt == "k"