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

class B:
    def __init__(self, txt: str):
        self.x: A = None
        self.txt = txt

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

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

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

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

i = A("i")
j = B("j")
a = C("a")
n = D("n")
m = E("m")
d = F("d")
h = A("h")

i.w = d
i.q = a
i.s = m
j.x = h
a.p = i
a.t = n
a.q = j
n.q = a
n.v = a
n.w = j
n.o = d
m.s = j
m.t = h
d.u = a
h.w = d
h.q = a
h.s = m
assert h.s.t.w.u.q.x.txt == "
class A:
    def __init__(self, txt: str):
        self.w: F = None
        self.q: C = None
        self.s: E = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.x: A = None
        self.txt = txt

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

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

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

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

i = A("i")
j = B("j")
a = C("a")
n = D("n")
m = E("m")
d = F("d")
h = A("h")

i.w = d
i.q = a
i.s = m
j.x = h
a.p = i
a.t = n
a.q = j
n.q = a
n.v = a
n.w = j
n.o = d
m.s = j
m.t = h
d.u = a
h.w = d
h.q = a
h.s = m
assert h.s.t.w.u.q.x.txt == "h"