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

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

class C:
    def __init__(self, txt: str):
        self.s: D = None
        self.txt = txt

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

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

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

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

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

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

class C:
    def __init__(self, txt: str):
        self.s: D = None
        self.txt = txt

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

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

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

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

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