class A:
    def __init__(self, txt: str):
        self.p: B = None
        self.u: B = None
        self.s: D = None
        self.y: B = None
        self.t: B = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.x: D = None
        self.s: C = None
        self.z: F = None
        self.txt = txt

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

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

class E:
    def __init__(self, txt: str):
        self.y: A = None
        self.z: B = None
        self.q: D = None
        self.o: F = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.w: E = None
        self.x: D = None
        self.z: E = None
        self.s: D = None
        self.txt = txt

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

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

class B:
    def __init__(self, txt: str):
        self.x: D = None
        self.s: C = None
        self.z: F = None
        self.txt = txt

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

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

class E:
    def __init__(self, txt: str):
        self.y: A = None
        self.z: B = None
        self.q: D = None
        self.o: F = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.w: E = None
        self.x: D = None
        self.z: E = None
        self.s: D = None
        self.txt = txt

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

n.p = b
n.u = b
n.y = b
n.t = b
n.s = f
b.x = f
b.s = c
b.z = h
c.p = e
c.v = n
c.s = h
f.u = e
f.v = b
e.y = n
e.z = b
e.q = f
e.o = h
h.w = e
h.z = e
h.x = f
h.s = f
assert h.w.q.u.z.s.s.txt == "h"