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

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

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

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

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

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

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

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

g.r = a
g.v = a
j.y = a
j.w = b
d.r = c
d.w = a
d.x = n
n.y = a
n.w = d
e.y = a
e.w = b
a.r = g
a.v = g
c.r = b
c.w = a
c.x = e
i.r = b
i.w = a
i.x = e
b.r = c
b.w = g
b.x = e
m.r = i
m.w = a
m.x = e
assert b.r.x.w.txt == "b"