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

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

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

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

class E:
    def __init__(self, txt: str):
        self.q: F = None
        self.x: C = None
        self.o: B = None
        self.u: F = None
        self.txt = txt

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

d = A("d")
j = B("j")
e = C("e")
n = D("n")
h = E("h")
b = F("b")

d.q = n
j.r = h
e.p = n
e.v = j
e.o = d
e.z = d
e.u = b
e.t = h
n.u = b
h.q = b
h.u = b
h.x = e
h.o = j
b.t = d
assert d.q.u.t.txt == "
class A:
    def __init__(self, txt: str):
        self.q: D = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.q: F = None
        self.x: C = None
        self.o: B = None
        self.u: F = None
        self.txt = txt

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

d = A("d")
j = B("j")
e = C("e")
n = D("n")
h = E("h")
b = F("b")

d.q = n
j.r = h
e.p = n
e.v = j
e.o = d
e.z = d
e.u = b
e.t = h
n.u = b
h.q = b
h.u = b
h.x = e
h.o = j
b.t = d
assert d.q.u.t.txt == "d"