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

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

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

i = A("i")
k = B("k")
b = C("b")
d = A("d")
j = C("j")
f = C("f")
e = C("e")
g = B("g")

i.x = b
k.o = g
k.y = g
k.w = b
b.x = g
b.t = e
d.x = e
j.x = k
j.t = f
f.x = g
f.t = e
e.x = k
e.t = b
g.o = k
g.y = k
g.w = j
assert j.t.t.x.txt == "
class A:
    def __init__(self, txt: str):
        self.x: C = None
        self.txt = txt

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

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

i = A("i")
k = B("k")
b = C("b")
d = A("d")
j = C("j")
f = C("f")
e = C("e")
g = B("g")

i.x = b
k.o = g
k.y = g
k.w = b
b.x = g
b.t = e
d.x = e
j.x = k
j.t = f
f.x = g
f.t = e
e.x = k
e.t = b
g.o = k
g.y = k
g.w = j
assert j.t.t.x.txt == "k"