class A:
    def __init__(self, txt: str):
        self.x: D = None
        self.u: B = None
        self.w: F = None
        self.r: E = None
        self.p: A = None
        self.t: E = None
        self.txt = txt

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.y: A = None
        self.u: E = None
        self.x: B = None
        self.z: B = None
        self.p: A = None
        self.txt = txt

m = A("m")
a = B("a")
j = C("j")
h = D("h")
b = E("b")
c = F("c")
n = C("n")
g = A("g")

m.x = h
m.u = a
m.w = c
m.r = b
m.t = b
m.p = g
a.w = g
j.p = c
j.s = n
j.t = n
j.w = m
h.w = g
b.q = n
c.y = g
c.p = g
c.u = b
c.x = a
c.z = a
n.p = c
n.s = j
n.t = j
n.w = m
g.x = h
g.u = a
g.w = c
g.r = b
g.t = b
g.p = m
assert h.w.w.y.p.p.x.w.p.txt == "
class A:
    def __init__(self, txt: str):
        self.x: D = None
        self.u: B = None
        self.w: F = None
        self.r: E = None
        self.p: A = None
        self.t: E = None
        self.txt = txt

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.y: A = None
        self.u: E = None
        self.x: B = None
        self.z: B = None
        self.p: A = None
        self.txt = txt

m = A("m")
a = B("a")
j = C("j")
h = D("h")
b = E("b")
c = F("c")
n = C("n")
g = A("g")

m.x = h
m.u = a
m.w = c
m.r = b
m.t = b
m.p = g
a.w = g
j.p = c
j.s = n
j.t = n
j.w = m
h.w = g
b.q = n
c.y = g
c.p = g
c.u = b
c.x = a
c.z = a
n.p = c
n.s = j
n.t = j
n.w = m
g.x = h
g.u = a
g.w = c
g.r = b
g.t = b
g.p = m
assert h.w.w.y.p.p.x.w.p.txt == "m"