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

class B:
    def __init__(self, txt: str):
        self.u: A = None
        self.txt = txt

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

j = A("j")
n = B("n")
h = C("h")
g = B("g")
d = B("d")
b = A("b")

j.z = b
j.w = h
j.r = h
n.u = b
h.o = g
h.w = j
h.v = b
g.u = b
d.u = b
b.z = j
b.w = h
b.r = h
assert d.u.z.z.r.o.txt == "
class A:
    def __init__(self, txt: str):
        self.z: A = None
        self.w: C = None
        self.r: C = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.u: A = None
        self.txt = txt

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

j = A("j")
n = B("n")
h = C("h")
g = B("g")
d = B("d")
b = A("b")

j.z = b
j.w = h
j.r = h
n.u = b
h.o = g
h.w = j
h.v = b
g.u = b
d.u = b
b.z = j
b.w = h
b.r = h
assert d.u.z.z.r.o.txt == "g"