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

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

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

h = A("h")
n = B("n")
f = C("f")
j = C("j")
g = C("g")

h.q = g
h.t = f
h.u = n
n.q = f
n.y = f
f.y = g
j.y = g
g.y = j
assert f.y.y.y.y.txt == "
class A:
    def __init__(self, txt: str):
        self.q: C = None
        self.t: C = None
        self.u: B = None
        self.txt = txt

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

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

h = A("h")
n = B("n")
f = C("f")
j = C("j")
g = C("g")

h.q = g
h.t = f
h.u = n
n.q = f
n.y = f
f.y = g
j.y = g
g.y = j
assert f.y.y.y.y.txt == "j"