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

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

class C:
    def __init__(self, txt: str):
        self.s: A = None
        self.v: A = None
        self.p: E = None
        self.u: A = None
        self.txt = txt

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

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

class F:
    def __init__(self, txt: str):
        self.s: D = None
        self.p: E = None
        self.r: C = None
        self.x: C = None
        self.q: E = None
        self.u: D = None
        self.txt = txt

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

h.w = n
h.s = f
h.z = f
d.p = f
d.q = n
d.u = g
g.s = h
g.v = h
g.u = h
g.p = n
i.z = h
i.v = h
n.u = g
n.w = h
f.s = i
f.u = i
f.p = n
f.q = n
f.r = g
f.x = g
j.p = f
j.q = n
j.u = g
assert f.s.v.w.u.txt == "
class A:
    def __init__(self, txt: str):
        self.w: E = None
        self.s: F = None
        self.z: F = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.s: A = None
        self.v: A = None
        self.p: E = None
        self.u: A = None
        self.txt = txt

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

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

class F:
    def __init__(self, txt: str):
        self.s: D = None
        self.p: E = None
        self.r: C = None
        self.x: C = None
        self.q: E = None
        self.u: D = None
        self.txt = txt

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

h.w = n
h.s = f
h.z = f
d.p = f
d.q = n
d.u = g
g.s = h
g.v = h
g.u = h
g.p = n
i.z = h
i.v = h
n.u = g
n.w = h
f.s = i
f.u = i
f.p = n
f.q = n
f.r = g
f.x = g
j.p = f
j.q = n
j.u = g
assert f.s.v.w.u.txt == "g"