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

class B:
    def __init__(self, txt: str):
        self.o: A = None
        self.p: A = None
        self.y: E = None
        self.q: F = None
        self.w: D = None
        self.txt = txt

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

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

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

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

m = A("m")
f = B("f")
b = C("b")
c = D("c")
k = E("k")
i = F("i")

m.q = b
m.v = c
f.o = m
f.p = m
f.y = k
f.q = i
f.w = c
b.v = k
b.u = m
b.p = f
b.o = i
c.v = k
k.t = m
i.o = m
i.w = m
assert f.y.t.q.u.q.txt == "
class A:
    def __init__(self, txt: str):
        self.q: C = None
        self.v: D = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.o: A = None
        self.p: A = None
        self.y: E = None
        self.q: F = None
        self.w: D = None
        self.txt = txt

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

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

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

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

m = A("m")
f = B("f")
b = C("b")
c = D("c")
k = E("k")
i = F("i")

m.q = b
m.v = c
f.o = m
f.p = m
f.y = k
f.q = i
f.w = c
b.v = k
b.u = m
b.p = f
b.o = i
c.v = k
k.t = m
i.o = m
i.w = m
assert f.y.t.q.u.q.txt == "b"