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

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

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

n = A("n")
j = B("j")
c = C("c")
e = A("e")
m = B("m")
f = C("f")

n.u = e
n.y = e
n.t = j
j.w = e
j.o = e
c.q = j
c.w = e
c.v = m
e.u = n
e.y = n
e.t = j
m.w = e
m.o = n
f.q = j
f.w = n
f.v = m
assert j.w.u.y.u.y.txt == "
class A:
    def __init__(self, txt: str):
        self.u: A = None
        self.y: A = None
        self.t: B = None
        self.txt = txt

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

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

n = A("n")
j = B("j")
c = C("c")
e = A("e")
m = B("m")
f = C("f")

n.u = e
n.y = e
n.t = j
j.w = e
j.o = e
c.q = j
c.w = e
c.v = m
e.u = n
e.y = n
e.t = j
m.w = e
m.o = n
f.q = j
f.w = n
f.v = m
assert j.w.u.y.u.y.txt == "e"