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

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

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

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

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

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

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

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

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

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

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

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

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

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

a.q = b
a.o = b
a.u = c
a.y = i
a.v = i
a.p = m
f.w = a
b.r = c
i.x = b
i.u = f
c.v = i
m.v = b
assert m.v.r.v.u.txt == "f"