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

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

class C:
    def __init__(self, txt: str):
        self.w: A = None
        self.y: D = None
        self.txt = txt

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

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

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

h = A("h")
g = B("g")
f = C("f")
e = D("e")
l = E("l")
j = F("j")

h.t = e
h.p = e
h.w = j
g.u = h
g.v = j
f.w = h
f.y = e
e.z = g
e.w = h
e.s = h
e.p = f
e.x = f
e.r = j
l.w = e
l.p = j
j.v = f
j.q = h
assert f.y.z.u.txt == "
class A:
    def __init__(self, txt: str):
        self.t: D = None
        self.w: F = None
        self.p: D = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.w: A = None
        self.y: D = None
        self.txt = txt

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

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

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

h = A("h")
g = B("g")
f = C("f")
e = D("e")
l = E("l")
j = F("j")

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