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

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

class C:
    def __init__(self, txt: str):
        self.o: A = None
        self.u: F = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.t: A = None
        self.v: B = None
        self.x: F = None
        self.z: A = None
        self.q: F = None
        self.txt = txt

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

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

d = A("d")
g = B("g")
h = C("h")
j = D("j")
c = E("c")
a = F("a")

d.z = a
d.q = c
d.r = c
g.o = c
h.o = d
h.u = a
j.t = d
j.z = d
j.v = g
j.x = a
j.q = a
c.z = j
a.t = c
assert a.t.z.v.txt == "
class A:
    def __init__(self, txt: str):
        self.z: F = None
        self.q: E = None
        self.r: E = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.o: A = None
        self.u: F = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.t: A = None
        self.v: B = None
        self.x: F = None
        self.z: A = None
        self.q: F = None
        self.txt = txt

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

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

d = A("d")
g = B("g")
h = C("h")
j = D("j")
c = E("c")
a = F("a")

d.z = a
d.q = c
d.r = c
g.o = c
h.o = d
h.u = a
j.t = d
j.z = d
j.v = g
j.x = a
j.q = a
c.z = j
a.t = c
assert a.t.z.v.txt == "g"