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

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

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

g = A("g")
d = B("d")
i = C("i")
j = B("j")
h = A("h")
k = A("k")
b = C("b")
m = B("m")

g.x = j
g.u = j
g.w = d
d.o = b
i.x = d
j.o = i
h.x = m
h.w = j
h.u = j
k.x = d
k.u = d
k.w = j
b.x = j
m.o = i
assert m.o.x.o.x.o.txt == "
class A:
    def __init__(self, txt: str):
        self.x: B = None
        self.w: B = None
        self.u: B = None
        self.txt = txt

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

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

g = A("g")
d = B("d")
i = C("i")
j = B("j")
h = A("h")
k = A("k")
b = C("b")
m = B("m")

g.x = j
g.u = j
g.w = d
d.o = b
i.x = d
j.o = i
h.x = m
h.w = j
h.u = j
k.x = d
k.u = d
k.w = j
b.x = j
m.o = i
assert m.o.x.o.x.o.txt == "i"