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

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

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

l = A("l")
j = B("j")
d = C("d")
g = C("g")

l.r = d
l.z = g
l.v = j
j.w = g
j.t = g
j.z = g
d.t = g
g.t = d
assert d.t.t.t.t.txt == "
class A:
    def __init__(self, txt: str):
        self.r: C = None
        self.z: C = None
        self.v: B = None
        self.txt = txt

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

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

l = A("l")
j = B("j")
d = C("d")
g = C("g")

l.r = d
l.z = g
l.v = j
j.w = g
j.t = g
j.z = g
d.t = g
g.t = d
assert d.t.t.t.t.txt == "d"