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

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

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

f = A("f")
d = B("d")
g = C("g")
j = A("j")
e = C("e")

f.y = d
d.z = f
g.t = j
g.v = j
j.y = d
e.t = f
e.v = j
assert g.v.y.z.txt == "
class A:
    def __init__(self, txt: str):
        self.y: B = None
        self.txt = txt

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

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

f = A("f")
d = B("d")
g = C("g")
j = A("j")
e = C("e")

f.y = d
d.z = f
g.t = j
g.v = j
j.y = d
e.t = f
e.v = j
assert g.v.y.z.txt == "f"