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

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

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

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

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

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

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

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

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

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

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

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

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

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

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