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

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

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

j = A("j")
h = B("h")
k = C("k")
n = C("n")
l = B("l")
f = C("f")
b = C("b")
i = C("i")

j.o = h
h.v = n
h.y = l
h.w = l
k.r = h
n.r = h
l.v = b
l.y = h
l.w = h
f.r = l
b.r = l
i.r = h
assert i.r.v.r.y.txt == "
class A:
    def __init__(self, txt: str):
        self.o: B = None
        self.txt = txt

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

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

j = A("j")
h = B("h")
k = C("k")
n = C("n")
l = B("l")
f = C("f")
b = C("b")
i = C("i")

j.o = h
h.v = n
h.y = l
h.w = l
k.r = h
n.r = h
l.v = b
l.y = h
l.w = h
f.r = l
b.r = l
i.r = h
assert i.r.v.r.y.txt == "l"