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

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

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

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

class E:
    def __init__(self, txt: str):
        self.q: F = None
        self.t: A = None
        self.w: C = None
        self.p: C = None
        self.v: D = None
        self.txt = txt

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

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

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

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

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

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

class E:
    def __init__(self, txt: str):
        self.q: F = None
        self.t: A = None
        self.w: C = None
        self.p: C = None
        self.v: D = None
        self.txt = txt

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

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

b.y = h
b.p = h
b.v = h
b.q = h
b.z = f
d.q = h
d.v = a
d.t = b
d.y = c
i.o = b
i.z = b
i.w = d
h.r = i
c.q = n
c.t = b
c.w = i
c.p = i
c.v = h
n.r = a
n.p = a
n.o = b
n.v = h
n.y = f
n.w = i
a.r = n
a.p = n
a.o = b
a.v = h
a.y = f
a.w = i
f.q = h
f.v = n
f.t = b
f.y = c
assert b.p.r.w.y.q.w.w.txt == "d"