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

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

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

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

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

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

n = A("n")
h = B("h")
a = C("a")
f = D("f")
e = E("e")
c = F("c")
d = D("d")

n.v = f
n.y = h
n.u = d
n.z = c
h.w = e
h.y = f
h.s = a
a.v = n
f.v = c
f.q = d
f.p = h
e.p = c
e.s = c
e.w = h
c.w = f
c.u = d
c.p = e
c.t = e
c.r = h
d.v = c
d.q = f
d.p = h
assert h.y.p.y.q.q.q.txt == "
class A:
    def __init__(self, txt: str):
        self.v: D = None
        self.y: B = None
        self.u: D = None
        self.z: F = None
        self.txt = txt

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

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

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

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

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

n = A("n")
h = B("h")
a = C("a")
f = D("f")
e = E("e")
c = F("c")
d = D("d")

n.v = f
n.y = h
n.u = d
n.z = c
h.w = e
h.y = f
h.s = a
a.v = n
f.v = c
f.q = d
f.p = h
e.p = c
e.s = c
e.w = h
c.w = f
c.u = d
c.p = e
c.t = e
c.r = h
d.v = c
d.q = f
d.p = h
assert h.y.p.y.q.q.q.txt == "d"