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

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

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

c = A("c")
e = B("e")
k = C("k")
d = B("d")

c.r = k
c.w = k
e.o = d
e.t = c
k.u = d
d.o = e
d.t = c
assert k.u.o.t.r.txt == "
class A:
    def __init__(self, txt: str):
        self.r: C = None
        self.w: C = None
        self.txt = txt

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

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

c = A("c")
e = B("e")
k = C("k")
d = B("d")

c.r = k
c.w = k
e.o = d
e.t = c
k.u = d
d.o = e
d.t = c
assert k.u.o.t.r.txt == "k"