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

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

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

g = A("g")
k = B("k")
c = C("c")
l = A("l")
a = C("a")
m = B("m")

g.r = k
g.u = k
g.t = c
k.u = l
k.q = l
k.x = a
c.s = g
c.o = l
c.x = a
l.r = k
l.u = k
l.t = a
a.s = g
a.o = l
a.x = c
m.u = l
m.q = g
m.x = c
assert a.s.r.x.s.t.txt == "
class A:
    def __init__(self, txt: str):
        self.r: B = None
        self.t: C = None
        self.u: B = None
        self.txt = txt

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

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

g = A("g")
k = B("k")
c = C("c")
l = A("l")
a = C("a")
m = B("m")

g.r = k
g.u = k
g.t = c
k.u = l
k.q = l
k.x = a
c.s = g
c.o = l
c.x = a
l.r = k
l.u = k
l.t = a
a.s = g
a.o = l
a.x = c
m.u = l
m.q = g
m.x = c
assert a.s.r.x.s.t.txt == "c"