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

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

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

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

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

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

j = A("j")
d = B("d")
f = C("f")
i = D("i")
e = E("e")
m = F("m")

j.w = m
j.z = i
j.q = d
j.p = f
d.x = m
f.q = j
f.w = j
f.p = d
f.u = i
i.q = m
i.r = f
i.s = e
e.t = f
m.z = f
m.q = f
assert f.p.x.q.txt == "
class A:
    def __init__(self, txt: str):
        self.w: F = None
        self.z: D = None
        self.q: B = None
        self.p: C = None
        self.txt = txt

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

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

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

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

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

j = A("j")
d = B("d")
f = C("f")
i = D("i")
e = E("e")
m = F("m")

j.w = m
j.z = i
j.q = d
j.p = f
d.x = m
f.q = j
f.w = j
f.p = d
f.u = i
i.q = m
i.r = f
i.s = e
e.t = f
m.z = f
m.q = f
assert f.p.x.q.txt == "f"