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

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

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

h = A("h")
l = B("l")
c = C("c")
j = A("j")

h.v = c
h.u = l
l.s = j
c.p = j
j.v = c
j.u = l
assert j.v.p.u.txt == "
class A:
    def __init__(self, txt: str):
        self.v: C = None
        self.u: B = None
        self.txt = txt

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

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

h = A("h")
l = B("l")
c = C("c")
j = A("j")

h.v = c
h.u = l
l.s = j
c.p = j
j.v = c
j.u = l
assert j.v.p.u.txt == "l"