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

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

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

m = A("m")
j = B("j")
c = C("c")
a = C("a")
h = B("h")
b = B("b")
i = B("i")

m.y = a
j.u = c
j.r = c
j.s = m
c.o = m
c.x = m
c.q = m
a.o = m
a.x = m
a.q = m
h.u = a
h.r = a
h.s = m
b.u = c
b.s = m
b.r = a
i.u = c
i.s = m
i.r = a
assert i.u.x.y.q.y.x.y.txt == "
class A:
    def __init__(self, txt: str):
        self.y: C = None
        self.txt = txt

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

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

m = A("m")
j = B("j")
c = C("c")
a = C("a")
h = B("h")
b = B("b")
i = B("i")

m.y = a
j.u = c
j.r = c
j.s = m
c.o = m
c.x = m
c.q = m
a.o = m
a.x = m
a.q = m
h.u = a
h.r = a
h.s = m
b.u = c
b.s = m
b.r = a
i.u = c
i.s = m
i.r = a
assert i.u.x.y.q.y.x.y.txt == "a"