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

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

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

j = A("j")
h = B("h")
d = C("d")
k = B("k")
a = A("a")
f = C("f")

j.x = h
h.t = f
h.p = f
h.u = k
d.s = f
d.r = f
d.y = h
k.t = d
k.p = f
k.u = h
a.x = k
f.s = d
f.r = d
f.y = h
assert d.r.s.y.t.y.p.txt == "
class A:
    def __init__(self, txt: str):
        self.x: B = None
        self.txt = txt

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

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

j = A("j")
h = B("h")
d = C("d")
k = B("k")
a = A("a")
f = C("f")

j.x = h
h.t = f
h.p = f
h.u = k
d.s = f
d.r = f
d.y = h
k.t = d
k.p = f
k.u = h
a.x = k
f.s = d
f.r = d
f.y = h
assert d.r.s.y.t.y.p.txt == "f"