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

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

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

l = A("l")
i = B("i")
e = C("e")
n = C("n")
g = B("g")
j = A("j")

l.y = j
l.p = i
i.z = g
e.u = l
n.u = j
g.z = i
j.y = l
j.p = i
assert e.u.p.z.txt == "
class A:
    def __init__(self, txt: str):
        self.y: A = None
        self.p: B = None
        self.txt = txt

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

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

l = A("l")
i = B("i")
e = C("e")
n = C("n")
g = B("g")
j = A("j")

l.y = j
l.p = i
i.z = g
e.u = l
n.u = j
g.z = i
j.y = l
j.p = i
assert e.u.p.z.txt == "g"