class A:
    def __init__(self, txt: str):
        self.y: D = None
        self.w: F = None
        self.s: C = None
        self.o: C = 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: B = None
        self.q: B = None
        self.txt = txt

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

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

class F:
    def __init__(self, txt: str):
        self.t: A = None
        self.s: A = None
        self.v: D = None
        self.w: C = None
        self.txt = txt

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

a.y = j
a.w = f
a.s = h
a.o = h
d.r = g
h.p = d
h.q = d
j.x = g
j.s = h
j.y = a
j.r = d
j.w = d
g.q = a
g.t = a
g.v = f
g.y = f
g.z = h
g.u = j
f.t = a
f.s = a
f.v = j
f.w = h
assert h.q.r.u.s.q.r.txt == "
class A:
    def __init__(self, txt: str):
        self.y: D = None
        self.w: F = None
        self.s: C = None
        self.o: C = 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: B = None
        self.q: B = None
        self.txt = txt

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

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

class F:
    def __init__(self, txt: str):
        self.t: A = None
        self.s: A = None
        self.v: D = None
        self.w: C = None
        self.txt = txt

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

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