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

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

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

class D:
    def __init__(self, txt: str):
        self.x: F = None
        self.w: E = None
        self.s: F = None
        self.r: B = None
        self.y: E = None
        self.o: E = None
        self.txt = txt

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

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

g = A("g")
n = B("n")
m = C("m")
d = D("d")
h = E("h")
e = F("e")
b = A("b")

g.w = e
g.p = h
g.q = h
g.v = m
g.r = b
n.q = m
n.x = m
n.t = e
m.u = d
m.y = n
d.x = e
d.s = e
d.w = h
d.y = h
d.o = h
d.r = n
h.u = d
h.z = b
e.p = g
e.s = h
b.w = e
b.p = h
b.q = h
b.v = m
b.r = g
assert h.z.w.p.w.s.u.txt == "
class A:
    def __init__(self, txt: str):
        self.w: F = None
        self.p: E = None
        self.q: E = None
        self.v: C = None
        self.r: A = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.x: F = None
        self.w: E = None
        self.s: F = None
        self.r: B = None
        self.y: E = None
        self.o: E = None
        self.txt = txt

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

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

g = A("g")
n = B("n")
m = C("m")
d = D("d")
h = E("h")
e = F("e")
b = A("b")

g.w = e
g.p = h
g.q = h
g.v = m
g.r = b
n.q = m
n.x = m
n.t = e
m.u = d
m.y = n
d.x = e
d.s = e
d.w = h
d.y = h
d.o = h
d.r = n
h.u = d
h.z = b
e.p = g
e.s = h
b.w = e
b.p = h
b.q = h
b.v = m
b.r = g
assert h.z.w.p.w.s.u.txt == "d"