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

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

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

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

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

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

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

d.w = f
d.z = h
j.s = g
j.w = g
j.v = f
h.t = n
i.w = h
i.o = a
a.s = i
b.u = g
b.y = a
k.s = i
g.t = n
n.s = g
n.w = g
n.v = d
f.w = d
f.z = h
assert d.z.t.v.z.txt == "
class A:
    def __init__(self, txt: str):
        self.w: A = None
        self.z: C = None
        self.txt = txt

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

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

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

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

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

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

d.w = f
d.z = h
j.s = g
j.w = g
j.v = f
h.t = n
i.w = h
i.o = a
a.s = i
b.u = g
b.y = a
k.s = i
g.t = n
n.s = g
n.w = g
n.v = d
f.w = d
f.z = h
assert d.z.t.v.z.txt == "h"