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

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

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

e = A("e")
n = B("n")
b = C("b")
c = B("c")
j = B("j")
g = C("g")
k = A("k")
m = A("m")

e.y = k
n.r = g
n.s = b
n.p = k
b.w = j
b.o = g
b.t = n
c.r = g
c.s = g
c.p = m
j.r = g
j.s = b
j.p = e
g.w = j
g.o = b
g.t = n
k.y = m
m.y = e
assert c.p.y.y.txt == "
class A:
    def __init__(self, txt: str):
        self.y: A = None
        self.txt = txt

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

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

e = A("e")
n = B("n")
b = C("b")
c = B("c")
j = B("j")
g = C("g")
k = A("k")
m = A("m")

e.y = k
n.r = g
n.s = b
n.p = k
b.w = j
b.o = g
b.t = n
c.r = g
c.s = g
c.p = m
j.r = g
j.s = b
j.p = e
g.w = j
g.o = b
g.t = n
k.y = m
m.y = e
assert c.p.y.y.txt == "k"