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

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

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

e = A("e")
j = B("j")
k = C("k")
h = B("h")
i = A("i")
l = A("l")
g = C("g")
f = B("f")
m = B("m")
b = B("b")

e.w = i
j.q = g
j.x = l
k.q = i
k.o = b
k.y = b
h.q = g
h.x = l
i.w = e
l.w = i
g.q = i
g.o = b
g.y = h
f.q = k
f.x = l
m.q = g
m.x = e
b.q = g
b.x = l
assert g.o.q.o.txt == "
class A:
    def __init__(self, txt: str):
        self.w: A = None
        self.txt = txt

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

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

e = A("e")
j = B("j")
k = C("k")
h = B("h")
i = A("i")
l = A("l")
g = C("g")
f = B("f")
m = B("m")
b = B("b")

e.w = i
j.q = g
j.x = l
k.q = i
k.o = b
k.y = b
h.q = g
h.x = l
i.w = e
l.w = i
g.q = i
g.o = b
g.y = h
f.q = k
f.x = l
m.q = g
m.x = e
b.q = g
b.x = l
assert g.o.q.o.txt == "b"