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

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

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

a = A("a")
l = B("l")
c = C("c")
b = C("b")
g = A("g")
e = C("e")
j = B("j")
n = B("n")

a.w = n
a.u = g
l.w = j
l.u = n
c.x = a
b.x = g
g.w = n
g.u = a
e.x = g
j.w = l
j.u = l
n.w = j
n.u = l
assert e.x.u.u.w.txt == "
class A:
    def __init__(self, txt: str):
        self.w: B = None
        self.u: A = None
        self.txt = txt

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

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

a = A("a")
l = B("l")
c = C("c")
b = C("b")
g = A("g")
e = C("e")
j = B("j")
n = B("n")

a.w = n
a.u = g
l.w = j
l.u = n
c.x = a
b.x = g
g.w = n
g.u = a
e.x = g
j.w = l
j.u = l
n.w = j
n.u = l
assert e.x.u.u.w.txt == "n"