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

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

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

k = A("k")
b = B("b")
h = C("h")
e = C("e")

k.t = e
b.y = h
b.x = e
h.x = e
h.t = b
e.x = h
e.t = b
assert k.t.x.x.x.txt == "
class A:
    def __init__(self, txt: str):
        self.t: C = None
        self.txt = txt

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

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

k = A("k")
b = B("b")
h = C("h")
e = C("e")

k.t = e
b.y = h
b.x = e
h.x = e
h.t = b
e.x = h
e.t = b
assert k.t.x.x.x.txt == "h"