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

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

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

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

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

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

f = A("f")
j = B("j")
a = C("a")
d = D("d")
h = E("h")
b = F("b")

f.w = j
f.z = h
j.y = d
j.x = h
j.u = f
a.t = d
a.u = d
a.z = b
a.p = j
d.r = j
d.q = f
h.v = b
b.q = a
assert b.q.z.q.txt == "
class A:
    def __init__(self, txt: str):
        self.w: B = None
        self.z: E = None
        self.txt = txt

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

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

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

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

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

f = A("f")
j = B("j")
a = C("a")
d = D("d")
h = E("h")
b = F("b")

f.w = j
f.z = h
j.y = d
j.x = h
j.u = f
a.t = d
a.u = d
a.z = b
a.p = j
d.r = j
d.q = f
h.v = b
b.q = a
assert b.q.z.q.txt == "a"