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

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

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

c = A("c")
b = B("b")
j = C("j")
e = B("e")
h = B("h")

c.y = h
b.v = h
b.p = j
b.t = c
j.x = h
j.u = c
e.v = b
e.p = j
e.t = c
h.v = e
h.p = j
h.t = c
assert b.p.x.v.p.u.txt == "
class A:
    def __init__(self, txt: str):
        self.y: B = None
        self.txt = txt

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

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

c = A("c")
b = B("b")
j = C("j")
e = B("e")
h = B("h")

c.y = h
b.v = h
b.p = j
b.t = c
j.x = h
j.u = c
e.v = b
e.p = j
e.t = c
h.v = e
h.p = j
h.t = c
assert b.p.x.v.p.u.txt == "c"