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

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

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

g = A("g")
k = B("k")
e = C("e")
l = A("l")
c = B("c")
d = C("d")
h = B("h")
j = C("j")

g.w = l
g.r = e
k.y = h
k.t = g
k.x = c
e.o = d
e.t = d
e.s = h
l.w = g
l.r = j
c.y = k
c.t = l
c.x = h
d.o = j
d.t = e
d.s = h
h.y = k
h.x = k
h.t = g
j.o = e
j.t = e
j.s = c
assert g.r.s.x.x.x.t.txt == "
class A:
    def __init__(self, txt: str):
        self.w: A = None
        self.r: C = None
        self.txt = txt

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

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

g = A("g")
k = B("k")
e = C("e")
l = A("l")
c = B("c")
d = C("d")
h = B("h")
j = C("j")

g.w = l
g.r = e
k.y = h
k.t = g
k.x = c
e.o = d
e.t = d
e.s = h
l.w = g
l.r = j
c.y = k
c.t = l
c.x = h
d.o = j
d.t = e
d.s = h
h.y = k
h.x = k
h.t = g
j.o = e
j.t = e
j.s = c
assert g.r.s.x.x.x.t.txt == "g"