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

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

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

c = A("c")
a = B("a")
j = C("j")
d = B("d")
m = A("m")
h = B("h")
g = A("g")
n = C("n")
b = C("b")
e = C("e")

c.y = b
c.x = n
c.v = h
a.p = e
a.v = c
j.w = d
j.z = b
j.y = a
d.p = e
d.v = c
m.y = j
m.x = j
m.v = h
h.p = b
h.v = c
g.y = b
g.x = n
g.v = a
n.w = d
n.z = b
n.y = a
b.w = h
b.y = h
b.z = j
e.w = a
e.z = b
e.y = h
assert d.p.y.p.y.v.v.p.y.p.txt == "
class A:
    def __init__(self, txt: str):
        self.y: C = None
        self.x: C = None
        self.v: B = None
        self.txt = txt

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

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

c = A("c")
a = B("a")
j = C("j")
d = B("d")
m = A("m")
h = B("h")
g = A("g")
n = C("n")
b = C("b")
e = C("e")

c.y = b
c.x = n
c.v = h
a.p = e
a.v = c
j.w = d
j.z = b
j.y = a
d.p = e
d.v = c
m.y = j
m.x = j
m.v = h
h.p = b
h.v = c
g.y = b
g.x = n
g.v = a
n.w = d
n.z = b
n.y = a
b.w = h
b.y = h
b.z = j
e.w = a
e.z = b
e.y = h
assert d.p.y.p.y.v.v.p.y.p.txt == "b"