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

class B:
    def __init__(self, txt: str):
        self.z: F = None
        self.y: A = None
        self.t: D = None
        self.w: C = None
        self.txt = txt

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

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

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

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

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

d.p = c
d.v = c
d.s = c
d.y = g
j.z = n
j.y = d
j.t = k
j.w = h
h.p = g
h.t = g
h.q = g
k.q = h
g.s = k
g.q = j
n.w = d
a.w = c
c.p = d
c.v = d
c.s = d
c.y = g
assert n.w.y.q.y.y.s.q.txt == "
class A:
    def __init__(self, txt: str):
        self.p: A = None
        self.v: A = None
        self.s: A = None
        self.y: E = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.z: F = None
        self.y: A = None
        self.t: D = None
        self.w: C = None
        self.txt = txt

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

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

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

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

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

d.p = c
d.v = c
d.s = c
d.y = g
j.z = n
j.y = d
j.t = k
j.w = h
h.p = g
h.t = g
h.q = g
k.q = h
g.s = k
g.q = j
n.w = d
a.w = c
c.p = d
c.v = d
c.s = d
c.y = g
assert n.w.y.q.y.y.s.q.txt == "h"