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

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

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

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

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

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

j = A("j")
c = B("c")
e = C("e")
h = D("h")
a = E("a")
f = F("f")

j.q = h
j.z = e
j.x = e
j.u = f
c.u = h
e.v = h
e.o = c
e.w = c
e.x = j
e.t = j
e.q = a
h.q = j
a.q = c
a.x = e
a.z = h
a.w = j
f.p = c
assert a.z.q.u.txt == "
class A:
    def __init__(self, txt: str):
        self.q: D = None
        self.z: C = None
        self.u: F = None
        self.x: C = None
        self.txt = txt

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

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

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

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

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

j = A("j")
c = B("c")
e = C("e")
h = D("h")
a = E("a")
f = F("f")

j.q = h
j.z = e
j.x = e
j.u = f
c.u = h
e.v = h
e.o = c
e.w = c
e.x = j
e.t = j
e.q = a
h.q = j
a.q = c
a.x = e
a.z = h
a.w = j
f.p = c
assert a.z.q.u.txt == "f"